Run this script to add snap-in automatically to ISE when it starts up.
if (!(test-path $profile )) {
new-item -type file -path $profile -force
}
$cmd = 'if((Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
Add-PSSnapIn "Microsoft.SharePoint.Powershell"
}'
out-file -FilePath $profile -InputObject $cmd -Append
Run this script to perform a quick user audit.
$site = Get-SPSite http://yourservername/sites/yoursitecollection
$groups = $site.RootWeb.sitegroups
foreach ($grp in $groups) {"Group: " + $grp.name; foreach ($user in $grp.users) {" User: " + $user.name} }
$site.Dispose()
Run this script to dump a user audit to a file.
$siteUrl = "http://yourservername/sites/yoursitecollection"
$web = Get-SPWeb $siteUrl
@(foreach ($group in $web.SiteGroups) {
foreach($user in $group.Users) {
$usergroup = New-Object System.Object
$usergroup | Add-Member -type NoteProperty -name GroupName -value $group.Name
$usergroup | Add-Member -type NoteProperty -name UserName -value $user.Name
Write-Output $usergroup
}
}) | Export-Csv c:\userlist.csv -NoTypeInformation