<#
******-----------------------------------------------------------------------******
Author -> Shiv Mangal Singh
Date -> 25th Jan - 2017
Description -> This script will generate a report to get the date of when the user was Added & modified in SharePoint Site.
Path of csv file->$path = "D:\contosoMW_Team\Shiv\UserInfoListDetails_25Jan17_report.csv"
Site Collection Name --> $Web = Get-SPWeb "https://ms.contoso.net/global/IAMAccessCertification/"
******-----------------------------------------------------------------------******
#>
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$Web = Get-SPWeb "https://ms.contoso.net/global/IAMAccessCertification/"
$OutPutFile = "D:\contosoMW_Team\Shiv\UserInfoListDetails_25Jan17_report.csv"
# $Web.SiteUserInfoList -->Here SiteUserInfoList: We are using for User Inforamtion List(To get User Inforamtion List)
$UserInfoList =$Web.SiteUserInfoList
#$ListItemCollection Array type variable to Hold Result - PSObjects
$ListItemCollection = @()
#Get All List items in User Inforamtion List
$UserInfoList.Items | foreach {
$ExportItem = New-Object PSObject
$ExportItem | Add-Member -MemberType NoteProperty -name "User Name" -value $_["Name"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Department" -value $_["Department"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Job Title" -value $_["Job Title"]
$ExportItem | Add-Member -MemberType NoteProperty -name "About Me" -value $_["About Me"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Created" -value $_["Created"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Modified" -value $_["Modified"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Scope" -value $Web.Url
#Add the object with property to an Array
$ListItemCollection += $ExportItem
}
#Export the result Array to CSV file
$ListItemCollection | Export-CSV $OutPutFile -NoTypeInformation
Write-host "User Information List Exported to $($OutputFile) for site $($Web)"
******-----------------------------------------------------------------------******
Author -> Shiv Mangal Singh
Date -> 25th Jan - 2017
Description -> This script will generate a report to get the date of when the user was Added & modified in SharePoint Site.
Path of csv file->$path = "D:\contosoMW_Team\Shiv\UserInfoListDetails_25Jan17_report.csv"
Site Collection Name --> $Web = Get-SPWeb "https://ms.contoso.net/global/IAMAccessCertification/"
******-----------------------------------------------------------------------******
#>
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$Web = Get-SPWeb "https://ms.contoso.net/global/IAMAccessCertification/"
$OutPutFile = "D:\contosoMW_Team\Shiv\UserInfoListDetails_25Jan17_report.csv"
# $Web.SiteUserInfoList -->Here SiteUserInfoList: We are using for User Inforamtion List(To get User Inforamtion List)
$UserInfoList =$Web.SiteUserInfoList
#$ListItemCollection Array type variable to Hold Result - PSObjects
$ListItemCollection = @()
#Get All List items in User Inforamtion List
$UserInfoList.Items | foreach {
$ExportItem = New-Object PSObject
$ExportItem | Add-Member -MemberType NoteProperty -name "User Name" -value $_["Name"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Department" -value $_["Department"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Job Title" -value $_["Job Title"]
$ExportItem | Add-Member -MemberType NoteProperty -name "About Me" -value $_["About Me"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Created" -value $_["Created"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Modified" -value $_["Modified"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Scope" -value $Web.Url
#Add the object with property to an Array
$ListItemCollection += $ExportItem
}
#Export the result Array to CSV file
$ListItemCollection | Export-CSV $OutPutFile -NoTypeInformation
Write-host "User Information List Exported to $($OutputFile) for site $($Web)"
No comments:
Post a Comment