The quickest way to do this is to write the PowerShell code itself. Below is an example of how the code will look in PowerShell, I would say that most C # developers should be able to understand the concepts of converting C # code to PowerShell in a very short time.
Functions can be a little weird at the beginning, as the usual PS syntax
myFunction Parameter1 Parameter2
You also really need to install PowerShell 3.0 and use the Windows PowerShell ISE tool for code development. In any case, you wonβt need more than 1-2 hours for your C # code to work in PowerShell.
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") Write-Host "This tool will copy the users from one group to another group" Write-Host "Please enter the URL of the site where your groups are available" [string] $siteUrl = [Console]::ReadLine() $site = new-object Microsoft.SharePoint.SPSite($siteUrl) try { $web = $site.OpenWeb() Write-Host "Please enter the name of the source group" [string] $sourceGroupName = [Console]::ReadLine() Write-Host "Please enter the name of the destination group" [string] $destinationGroupName = [Console]::ReadLine() $sourceUsers = $web.Groups[$sourceGroupName] (and so on) } catch { Write-Error ("Failed to copy sharepoint users." + $_) }
source share