Tag Info

Hot answers tagged

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 Update $SPWebApp = Get-SPWebApplication https://*******.com/ foreach ($SPSite in $SPWebApp.Sites) { write-host -foregroundcolor green "Working on Site ...


2

Instead of using foreach loop, try performing operation using a for loop. for($node=0;$node -lt $nodeC.Count;$node++){ $nodeVal = $nodeC[$node]; $nodeC.Delete($nodeVal);}


2

The SPList does not have Name property. Instead use Title property. Modified code: Get-SPWeb http://sitecollection/sites/site/subsite | Select -ExpandProperty Lists | Where { $_.GetType().Name -eq "SPDocumentLibrary" -and $_.Title -eq "Site Pages" } | Select -ExpandProperty Items | Select Name, {$_.File.Length}, url


1

There are few things to consider here. As is clear, you want to copy the documents from Source library to destination library and also preserve the folder structure. Documents can reside directly inside the source library at the root location. This folder is called Root Folder in SharePoint and it can be retrieved using $RootFolder = $sList.RootFolder. ...


1

Try this PowerShell to get rid of missing FileRef issue: $web = Get-SPWeb -Identity http://aissp2013/sites/Team $dList = $web.Lists["Doc2"] $folder = $dList.AddItem($dList.RootFolder.ServerRelativeUrl, [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, "Folder2") $folder["Title"] = "Test" $folder.Update() This will create a folder with Name "Folder2" ...


1

Stapling only affects new Sites. You can use PowerShell to iterate all your sites and activate your MasterPage Feature Get-SPSite -Limit all | %{ Enable-SPFeature -ID "<Your Feature ID>" -Url $_ }


1

You can use PowerShell to identify the feature. Get-SPFeature | Where-Object { $_.DisplayName -like "Excel*" } You can disable feature using Disable-SPFeature –identity "ExcelServerEdit" -URL http://webapp


1

The error you get with your code when used for a subsite is because you use Get-Site with a subsite Url. Instead of Get-SPSite use Get-SPWeb as below: Get-SPWeb http://server/sites/yoursite | Select -ExpandProperty Groups | Where {$_.Name -EQ "your group name here"} | Select -ExpandProperty Users | Select Name, Email The code above will find the group ...


1

I don't recall the reason, but I had also faced this problem and the solution was to first create SPSite object and use it in get-spweb. $siteURL = "http://server:80/sites/sitename" $webURL = "/subsitename" $site = get-spsite $siteURL get-spweb -site $site $webURL


1

The first way is kind of manual way where you are creating the SPWeb object and then disabling the property of the object. The second way is the correct method. It uses the Out of the box PowerShell CMDLet to disable the feature. If you are planning to disable for all then use foreach($webApp in Get-SPWebApplication) { foreach ($SPsite in ...


1

Similar to the above answer but check if the web application time zone and the server time zone are identical, you could refer this article: Time zone issue


1

http://www.dmcinfo.com/Latest-Thinking/Blog/articleType/ArticleView/articleId/8471/Using-SPWebProcessBatchData-to-Update-Document-Library-Properties.aspx Summary: When running ProcessBatchUpdate on a document library you need to pass the server relative url of the file in each item. Use SPListItem.File.ServerRelativeUrl or ...


1

Assuming you have same destination fields with same type as in source list following PowerShell will solve the purpose... try { # OUTPUT TO SCREEN THE CURRENT SPWEB. write-host "Working on Web: "$_.Title -ForegroundColor Green $numDaysToExpire = $ExpireDays $expireDate = Get-Date $expireDate = $expireDate.AddDays(-$numDaysToExpire) ...


1

To allow the web service to upload larger files try to increase the value of maxRequestLength (system.web/httpRuntime) as well as the value of maxAllowedContentLength (system.webServer/security/requestFiltering/requestLimits) See this forum thread.


1

you need to cycle one way or the other, by this i mean iterate either through ad groups or through sharepoint groups and compare the two.... im lazy and created a console application that explains how todo it. When i get the chance i will post PS code! .cs code is checking against AD and looping sharepoint as i think you could have many AD groups and less ...


1

That will only work with the local instance or machines joined to same domain. You can look at remoting but you need to configure it to work with non-domain machine. For instance - If you want run from Dev.com and connect to Prod.com you have to set your SharePoint servers on Prod to trust the machine in the Dev domain to run PowerShell command. To add ...


1

Try to use RunWithElevatedPrivileges.... if(-not(Get-PSSnapin | Where { $_.Name -eq "Microsoft.SharePoint.PowerShell"})) { Add-PSSnapin Microsoft.SharePoint.PowerShell; } [Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges( { $web = get-spweb http://xyz/ $list = $web.lists | where {$_.title -eq “Employee”} #Write-host “List ...


1

Make sure you are opening "SharePoint Management Shell" and not "Windows PowerShell" Make sure the account you logged in has enough permission. Also try opening the SharePoint Management Shell by selection Run as administrator context menu. First try below snippet and check you are able to see output on the screen write-host "Starting Script" ...


1

You remove Microsoft CRM Visitors, and rmvd\timc becomes RoleAssignments[0]. So in the next iteration you remove RoleAssignments[1] which is now rmvd\amyw. RoleAssignments[2] is now empty. You need to either always remove the last entry, or do this using a while loop.


1

SPWeb is a subsite inside a site collection. But you want to create a new root site under a managed path, so have to create a new site collection. With a new site collection, a new SPWeb is also generated as the root site. New-SPSite https://example.com/sites/apple -Name "Apple" -Template "STS#0" PS: New-SPWeb is used, if you want to create another ...


1

Eric Soo found the answer: setting the ObjectID field. But a bit of powershell code might come in handy for people not knowing where to look for that specific field. $list = $rootWeb.Lists |? {$_.RootFolder.ServerRelativeUrl -eq "/Relationships List"} $items = $list.Items foreach($item in $items) { $item["ObjectID"] = "$($rootWeb.Url), /" ...



Only top voted, non community-wiki answers of a minimum length are eligible