Skip to main content

Posts

Showing posts from July, 2020

Powershell Script to get all SharePoint wsp solutions

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $dirName = "C:\WSP" if (!(Test-Path -path $dirName)) { New-Item $dirName -type directory } Write-Host Exporting solutions to $dirName foreach ($solution in Get-SPSolution) {     $id = $Solution.SolutionID     $title = $Solution.Name     $filename = $Solution.SolutionFile.Name     Write-Host "Exporting ‘$title’ to …\$filename" -nonewline     try {         $solution.SolutionFile.SaveAs("$dirName\$filename")         Write-Host " – done" -foreground green     }     catch     {         Write-Host " – error : $_" -foreground red     } } Note: If need any help please reach out to me at kamal_pandey@outlook.com.  I would be very happy to help. 

Powershell Script to Restrict Group Creation on Office 365

$GroupName = "<SecurityGroupName>" $AllowGroupCreation = "False" Connect-AzureAD $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id if(!$settingsObjectID) { $template = Get-AzureADDirectorySettingTemplate | Where-object {$_.displayname -eq "group.unified"}     $settingsCopy = $template.CreateDirectorySetting()     New-AzureADDirectorySetting -DirectorySetting $settingsCopy     $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id } $settingsCopy = Get-AzureADDirectorySetting -Id $settingsObjectID $settingsCopy["EnableGroupCreation"] = $AllowGroupCreation if($GroupName) { $settingsCopy["GroupCreationAllowedGroupId"] = (Get-AzureADGroup -SearchString $GroupName).objectid }  else { $settingsCopy["GroupCreationAllowedGroupId"] = $GroupName } Set-AzureADDirectorySetting -Id $

Solve Missing user profile picture in SharePoint 2019

Dear All,  Below is the Powershell script that will help you solve broken profile picture issue. $mySiteNewHostURL = "http://NewMySiteHostURL" $mySiteOldHostURL = "http://OldMySiteHostURL" $mySite = Get-SPSite $mySiteNewHostUrl $SPServiceContext = Get-SPServiceContext $mySite $userProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($SPServiceContext) $userProfiles = $userProfileManager.GetEnumerator() foreach ($userProfile in $userProfiles) { #check if the picture property contain image URL, then replace it with new my site host URL if ($userProfile["PictureURL"] -ne '') { $oldImageUrl = $userProfile["PictureURL"].toString() $newImageUrl = $oldImageUrl -Replace $mySiteOldHostURL, $mySiteNewHostURL write-host "Old Image Link = " $oldImageUrl " --> New Image Link = " $newImageUrl $userProfile["PictureURL"].Value = $newImageUrl $userP