Title: Get The Quicklinks for all users from UserProfile
- #Add SharePoint PowerShell SnapIn if not already added
- if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
- Add-PSSnapin "Microsoft.SharePoint.PowerShell"
- }
- $context = Get-SPServiceContext -Site http://people.in.lakku.com.au
- $upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
- $AllProfiles = $upm.GetEnumerator()
- #$profile = $upm.GetUserProfile("domainname\id")
- $date = Get-Date -format MMddyyy
- $OutPutFilename="F:\LB\Links.csv"; #test purose in my PC
- "Site URL" + "," +"Last ModifiedBy"+ ","+ "Last Modified Date" | Out-File -Encoding Default -FilePath $OutPutFilename;
- foreach($profile in $AllProfiles)
- {
- $qlm = $profile.QuickLinks
- foreach($link in $qlm.GetItems())
- {
- $AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value
- # write-host $link.Group $link.Url
- $AccountName + "," + $link.Group +"," +$link.Url| Out-File -Encoding Default -Append -FilePath $OutPutFilename;
- }
- }