A task was assigned to me to update 5000 telephone numbers in SharePoint..... easiest method to script and read from CSV - as so .....
Input file format (CSV) - Important note the headers have to be exactly whats in script
ntname,number
domain\smith,898021889
domain\brown,78798798
Script to read through and update WorkPhone
#First load the SharePoint commands
#add-PSSnapIn Microsoft.SharePoint.PowerShell
#Set up the job variables
$csvfile="TelephoneNumbers.csv"
$mySiteUrl = "<mysiteurl>"
$upAttribute = "WorkPhone"
#Connect to User Profile Manager service
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
#Create Lists from each item in CSV file
$csvData = Import-Csv $csvfile
#Now iterate through the list to update the attribute with new value
foreach ($line in $csvData)
{
#Check to see if user profile exists
if ($profileManager.UserExists($line.NTName))
{
#Get user profile and change the value
$up = $profileManager.GetUserProfile($line.NTName)
# $up[$upAttribute].Value = $line.PropertyVal
$up[$upAttribute].Value = $line.number
$up.Commit()
}
else
{
write-host "Profile for user"$line.NTName "cannot be found"
}
}
#Dispose of site object
$site.Dispose()
This blog covers SharePoint topics and issues that I have come across with SharePoint 2007 and 2010 - hopefully to help others !
Wednesday, September 25, 2013
SharePoint 2010 - Object Cache: The super user account utilized by the cache is not configured.
Following error is appearing as warning on Web front ends
Object Cache: The super user account utilized by the cache is not configured. This can increase the number of cache misses, which causes the page requests to consume unneccesary system resources.
To configure the account use the following command 'stsadm -o setproperty -propertyname portalsuperuseraccount -propertyvalue account -url webappurl'. The account should be any account that has Full Control access to the SharePoint databases but is not an application pool account.
Additional Data:
Current default super user account: SHAREPOINT\system
If you think that having object caching isn't going to cause an issue with content use the following to resolve
1. Verify that you have the following administrative credentials:
To create the user accounts in Central Administration, you must be a member of the Farm Administrators group on the computer that is running the SharePoint Central Administration Web site.
2. On the Central Administration Web site, in the Application Management section, click Manage web applications.
3. Click the name of the Web application that you want to configure.
4. On the Web Applications tab, in the Policy group, click User Policy.
5. In the Policy for Web Application window, click Add Users.
6. From the Zones list, select All zones, and then click Next.
7. In the Users box, type the user name for the Portal Super User account. - domain\spsuperuser
8. Click the Check Names icon to ensure that the account name can be resolved by the authentication providers on the application server.
9. In the Choose Permissions section, check the Full Control - Has full control box.
10. Click Finish.
11. Repeat Steps 5 through 8 for the Portal Super Reader account.
12. In the Choose Permissions section, check the Full Read - Has full read-only access box. - domain\spsuperreader
13. Click Finish.
14. Make note of how the names for the Object Cache Super Reader and Object Cache Super User accounts are displayed in the User Name column. The displayed strings will be different depending on whether you are using claims authentication for the Web application.
Powershell to run
$wa = Get-SPWebApplication -Identity "<App Identity from IIS>"
$wa.Properties["portalsuperuseraccount"] = "domain\spsuperuser"
$wa.Properties["portalsuperreaderaccount"] = "doamin\spsuperreader"
$wa.Update()
And to rollback ....
$wa = Get-SPWebApplication “http://urlofthewebapplication”
$wa.Properties.Remove("portalsuperuseraccount")
$wa.Properties.Remove("portalsuperreaderaccount")
$wa.Update()
Object Cache: The super user account utilized by the cache is not configured. This can increase the number of cache misses, which causes the page requests to consume unneccesary system resources.
To configure the account use the following command 'stsadm -o setproperty -propertyname portalsuperuseraccount -propertyvalue account -url webappurl'. The account should be any account that has Full Control access to the SharePoint databases but is not an application pool account.
Additional Data:
Current default super user account: SHAREPOINT\system
If you think that having object caching isn't going to cause an issue with content use the following to resolve
1. Verify that you have the following administrative credentials:
To create the user accounts in Central Administration, you must be a member of the Farm Administrators group on the computer that is running the SharePoint Central Administration Web site.
2. On the Central Administration Web site, in the Application Management section, click Manage web applications.
3. Click the name of the Web application that you want to configure.
4. On the Web Applications tab, in the Policy group, click User Policy.
5. In the Policy for Web Application window, click Add Users.
6. From the Zones list, select All zones, and then click Next.
7. In the Users box, type the user name for the Portal Super User account. - domain\spsuperuser
8. Click the Check Names icon to ensure that the account name can be resolved by the authentication providers on the application server.
9. In the Choose Permissions section, check the Full Control - Has full control box.
10. Click Finish.
11. Repeat Steps 5 through 8 for the Portal Super Reader account.
12. In the Choose Permissions section, check the Full Read - Has full read-only access box. - domain\spsuperreader
13. Click Finish.
14. Make note of how the names for the Object Cache Super Reader and Object Cache Super User accounts are displayed in the User Name column. The displayed strings will be different depending on whether you are using claims authentication for the Web application.
Powershell to run
$wa = Get-SPWebApplication -Identity "<App Identity from IIS>"
$wa.Properties["portalsuperuseraccount"] = "domain\spsuperuser"
$wa.Properties["portalsuperreaderaccount"] = "doamin\spsuperreader"
$wa.Update()
$wa = Get-SPWebApplication “http://urlofthewebapplication”
$wa.Properties.Remove("portalsuperuseraccount")
$wa.Properties.Remove("portalsuperreaderaccount")
$wa.Update()
Powershell Script to Connect to Domain Controllers
We have been seeing some issues with our servers not being able to connect to DC's - to help diagnose the issues the following scripts were useful
This gets all the DC's and pings
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
| % { $_.DomainControllers } | %{Test-Connection $_.Name}
The next one-liner connects to each of the DC's on 389
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
| % { $_.DomainControllers } | %{$o=new-object
Net.Sockets.TcpClient;$o.Connect( $_.IPAddress, 389); new-object PSObject
-Property @{name=$_.Name;connected=$o.Connected}}
Subscribe to:
Posts (Atom)