New answers tagged

0

to run the import command, you have to make sure couple of things. Make sure destination site collection / subsite should be created 1st. Iw ould prefer to create it using powerShell without assigning any template. New-SPWeb http://sitename Now run the Import command.


0

check this one [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") $password = Read-Host -Prompt "Enter password" -AsSecureString $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("userID@yourtenant.com", ...


0

You may also get help from this blog for migrating SharePoint on-premises to SharePoint Online natively, which involves usage of Azure Storage: http://sharepoint-content-migration.blogspot.in/2016/05/a-4-step-guide-for-migrating-sharepoint.html


1

You can do the followin in PowerShell: #retrieve the SPO Operation return value during creation $spOnlineOperation = $tenant.CreateSite($properties) #load the tenant object $ctx.Load($tenant) #load the SPO operation $ctx.Load($spOnlineOperation) #run the command $ctx.ExecuteQuery() #wait for SPO Operation to complete while($spOnlineOperation.IsComplete ...


0

You can update Master page of any site using powershell by using following code $site = Get-SPSite http://sp:2000/sites/Ex15 foreach ($web in $site.AllWebs) { $web.MasterUrl = $site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/oslo.master"; $web.CustomMasterUrl = $site.RootWeb.ServerRelativeUrl + ...


0

You can update Master page of any site using powershell by using following code $site = Get-SPSite http://sp:2000/sites/Ex15 foreach ($web in $site.AllWebs) { $web.MasterUrl = $site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/oslo.master"; $web.CustomMasterUrl = $site.RootWeb.ServerRelativeUrl + ...


0

You can delete site collection using powershell by using following command $tmpRoot = Get-SPWebApplication -Identity http://SP:2000 $tmpRootColl=$tmpRoot.Sites #Enumerate through each site collection for ($index=$tmpRootColl.Count-1 ; $index-ge 0 ; $index–-) { Remove-SPSite -Identity $tmpRootColl.Item($index) -GradualDelete -Confirm:$false } ...


0

You can delete site collection using powershell by using following command $tmpRoot = Get-SPWebApplication -Identity http://SP:2000 $tmpRootColl=$tmpRoot.Sites #Enumerate through each site collection for ($index=$tmpRootColl.Count-1 ; $index-ge 0 ; $index–-) { Remove-SPSite -Identity $tmpRootColl.Item($index) -GradualDelete -Confirm:$false } ...


2

Unfortunately, persistent columns are sealed meaning they cannot be deleted once created. You got 2 solutions (workaround) that you can try: Hide the column instead of deleting it and remove it from the view it was added. Create a new document library and copy all the documents into it (you can utilize the Open in explorer for easy copy/paste and use the ...


0

Doesn't sound like this is a Sharepoint issue. what you're looking for is a way to get a subset of the array to work with: http://stackoverflow.com/questions/28460208/what-is-the-idiomatic-way-to-slice-an-array-relative-to-both-of-its-ends


2

You can use the following to copy site to another site within the site collection Site Setting --> Site Administration --> Content and structure --> Select the site from the left navigation and move To copy to another site collection: try using copy site as a template (include content) and then use the template file to create a new site under the other site ...


2

The powershell coverage is weak, so you aren't going to have export options like you would on prem. You would have to create a script with CSOM, as a compiled exe or in powershell, to perform the provisioning and copying data around. If this is a one off scenario that might be ok, if you foresee the need to do this often, you might want to invest in a ...


1

Ok, using @Mohamed and @Hardik's answer.. I scripted the following which allowed me to update the "Created By" Add-PSSnapin Microsoft.SharePoint.Powershell $SPWeb = Get-SPWeb "http://server/site" $userName = "i:0#.w|domain\username"; $user = Get-SPUser -web $SPWeb -Identity $userName; $userString = "{0};#{1}" -f $user.ID, ...


1

Below mentioned code will help you to update Author based on some conditions. // Get the SharePoint Assembly // You will need to run this on the SharePoint Server [Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") // The site my list was in was at http://dev // create a new object called ...


2

Refer to this post: Cannot update Created By (Author) field through powershell Basically you need to get a reference to the item, then do something like this: $SPListItem["Author"] = $userString; $SPListItem.UpdateOverwriteVersion();


0

Turns out there are a couple ways to do this; The first one I found looks like this: $Item = Get-SPOListItem -List SEDA -Fields "FileLeafRef" | %{new-object psobject -property @{Id = $_.Id; Filename = $_["FileLeafRef"]}} | select Id, Filename | where {$_.Filename -eq $($r.Filename)} Set-SPOListItem -List SEDA -Identity $($Item.Id) ...


0

Sites will be migrated when you change the Site Naming Format, but last I looked, not the user's username [using Move-SPUser].


0

$web = Get-SPWeb <url> $childList = $web.Lists["Employees"] $parentList = $web.Lists["Countries"] $childList.Fields.AddLookup("Country", $parentList.ID, $true) $field = $childList.Fields.getfield("Country") $fieldLink = New-Object Microsoft.SharePoint.SPFieldLink($field) $ctype = $childList.ContentTypes["MyLookupField"] ...


2

You can simply use the SharePoint Management Shell instead which has pathing for psconfig, but instead, use PowerShell. Initialize-SPResourceSecurity is the replacement for that specific command.


0

Either it's a bug or by design by Microsoft. We are in the process of migration and we have received tons of complaints that their files are missing. I have no choice but hit the sql db directly. here is the sql query that worked like I intended. I am NOT liable if your record(s) locks up due to this query. Use at your own risk. 1. Go to the database and ...


0

I've done it this way for our PS module. Function Get-Features { <# .SYNOPSIS Gets all the site or web features .DESCRIPTION Gets all the site or web scoped features of a site, useful in conjunction with Set-SiteCollectionFeature or Set-SiteFeature .PARAMETER Url The Url of the site ...


2

If the site is not available in 1st and 2nd stage recycle bin then that means it is gone completely. Now the only option is to restore it from Backup. If you have backup of your site collection then restore just before you deleted the subsite. If you have content DB backup then restore it and using the Unattached Content Database recovery and export the ...


0

Try putting this in your REST search call: &refiners='ManagedProperties(filter%3d600%2f0%2f*)' It will return all managed properties of the found item as refiners (you could restrict your query to content type for example). Have a look at this search tool. It is great for testing search queries and seeing all managed properties: ...


0

I've found a way to migrate the Managed Metadata into our test farm. It does not solve my timeout issue in Powershell, but the data got transferred with same term guids. Maybe someone needs to do the same. 1) Make a backup of your Managed Metadata by creating a SQL dump of the Managed Metadata database and transfer this dump file to your SQL system of ...


0

I tried this code it will list Roles that start with Edit.If you know the Role then rhis code can be helpful. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $site = New-Object Microsoft.SharePoint.SPSite("http://spe131:5664/") $groups = $site.RootWeb.sitegroups foreach ($grp in $groups) { "Group: " + $grp.Roles; ...


0

You can get Permission reports by User wise include who has edit permission you can filter out from that > function Get-SPPermissionsReport($web, $recursive) { $web | > Get-SPUser | % { New-Object PSObject -Property @{ > UserLogin = $_.UserLogin > 'Roles given explicitly' = $_.Roles > 'Roles given via groups' = $_.Groups | ...


0

Below script is available in Technet. This script basically list permission for all users irrespective of their permission level. You can export this to CSV and use Excel to filter only Edit. GetUserAccessReport "http://site" > "c:\path\permision_report.csv" You can download script from ...


0

There is not such method available OOTB which will just backup the content of the site collection. But you can think about the following workaround. Backup and Restore the site collection, After restoring the site collection, Delete all content from the site collection Now you can use this as backup i.e take another backup of this and use it for future. ...


0

Hi Sandy I believe this question has been asked and answered. Please see the link. Can you backup a site collection structure but not include the content? I have used the Chris O'Brien tool and it worked amazingly. You will be able to keep security setting if needed or if you need to move content from one location to the next it will preserve all of the ...


0

There are a few approaches to backup/restore managed metadata between environments. OOB, SharePoint 2010 allows for ONLY importing managed metadata in CSV format. You are required to use Powershell / Object Model to build the csv file. Here is a script that can do it. Managed metadata terms and termsets each have a unique guid. If you take a backup of a ...


0

I have also now fixed the error which the script had that was unrelated to the question and this script should now work as intended. ### Get the user credentials $credential = Get-Credential $username = $credential.UserName $password = $credential.GetNetworkCredential().Password $securePassword = ConvertTo-SecureString $password -AsPlainText -Force ### ...


0

Turns out there are 4 date fields in the CSV file, and if any of them are empty, all of the examples above fail! I added if ([bool]$_."Date Created") {...} to each of the date lines to resolve this case.


0

This will do it: foreach($ma in Get-SPManagedAccount){$ma.UserName}


0

Try below code foreach($ma in get-spmanagedaccount) { write-host $ma.DisplayName write-host $ma.UserName }


0

Take a look here for the CSOM PowerShell to download files from SPO https://gallery.technet.microsoft.com/scriptcenter/How-to-automactically-1bc0ddd6 or use OfficeDevPnP PowerShell https://github.com/OfficeDev/PnP-PowerShell highly recommended!


1

I tested your script and found the problem. The answer is here http://stackoverflow.com/questions/35225511/sharepoint-csom-copy-roleassignment your last lines should be: # Apply the permission roles to the list. $clientContext.Load($folder1.ListItemAllFields.RoleAssignments.Add($usr, $usrRole)) ...


0

You can try the below mentioned script on each farm. $mc = Get-SPManagedAccount foreach($acc in $mc) { Set-SPManagedAccount -Identity $acc -ExistingPassword (ConvertTo-SecureString “pass@word2” -AsPlainText -force) –confirm } But drawback is all accounts will have the same password.check this technet for more options: ...


-1

try PowerShell pnp, it should be helpful. https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/RemoveSPOEventReceiver.md


2

Use the PnP PowerShell CmdLets, and you can do this with one line of code: Add-SPOTaxonomyField -DisplayName "Region" -InternalName "Region" -TermSetPath "Contoso|Region" Documentation Implementation


0

The issue you are experiencing is that the cmdlet cannot properly pipe SPWebApplication object. (at least from the error) If you try: $w = Get-SPWebApplication http://intranet.vspserver.test-lab.local. You should get an error as well, maybe more descriptive this time. Other thing is that I can defo see an issue with your URL, is it correct that it ...


0

Firstly I agree with @Aveenav that you should look into the building wsp package, that will follow Sharepoint model, it will place the master page in layouts directory, push it if you connect servers etc. But if you really need to, you can place in the SP library, and call it from there (you can place in the layouts as well but you will have to keep that ...


-1

Try: {your site}/_layouts/15/ChangeSiteMasterPage.aspx Amal's answer didn't have the 15 in it. I don't have enough rep to add a comment to his solution.


0

Instead of using PowerShell, create a WSP package and hookup and event receiver for the feature that sets the master page. That way you can apply same master page to sub sites.


0

Try appending URL /_layouts/changesitemasterpage.aspx


0

This actually made me switch to the following code instead of add-spofile: $Context = Get-SPOContext #Retrieve list $List = $Context.Web.Lists.GetByTitle("DocLib") $Context.Load($List) $Context.ExecuteQuery() #Upload file Foreach ($File in (dir $folder)) { $FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open) $FileCreationInfo ...


2

Should you not do UserCustomAction.Update() after you set the new script source? (also you may want to store the action in a variable: try{ $theAction = $customActions.GetById($Id) $theAction.ScriptSrc = $ScriptSrc $theAction.Update() $context.ExecuteQuery() Write-Host "CustomAction $Id updated" -ForegroundColor Green } catch{ ...


2

You can use below snippet Get-SPUser -Web http://server/sites/yoursite | Where { $_.IsDomainGroup } AD group is treated as a special user. So this can be find using the filter IsDomainGroup $SPWebApp = Get-SPWebApplication https://*******.com/ foreach ($SPSite in $SPWebApp.Sites) { write-host -foregroundcolor green "Working on Site ...


1

Have you tried this Deactivate Sandbox Solution with PowerShell in Office 365 Also have a look to this link too, it contains the way to deactivate solution I am not sure about this as i haven't faced this problem but i guess it can help you.


0

As well as the normally documented steps for making PS Remoting work with SharePoint 2010/13, I have found that one additional step is required. RDP into one of your farm servers and open the SharePoint Management Shell. $w = Get-SPWebApplication https://my.site.com $w.GrantAccessToProcessIdentity("mydomain\myusername") You will need to do this for every ...


0

I also have same problem. After couple of hours of googling I have found this link http://codecaching.blogspot.ru/2012/11/importing-cmp-and-string-was-not.html There was a problem with wrong year in date 29 May 60354 05:36:10 -0000 In my case in have not found any wrong dates in my Manifest.xml files but I have found some max dates like 31 Dec 9999 ...



Top 50 recent answers are included