SharePoint Web Services GUIDs – named

I’m always forgetting this command to translate those silly GUID services into text which is understandable. So here it is, where we can all find it. Get-SPServiceApplication | sort Id | FT -property Id, DisplayName -AutoSize

1

SharePoint – SPmonitoredScope – Dashboard

In order for custom code to show up in the dev dashboard you need to make use of the SpMonitoredScope: using (new SPMonitoredScope(“My Scope Name”)){   doSomeWork(); }  http://msdn.microsoft.com/en-us/library/ff512758.aspx  We have been finding that a few tough issues should have been trivial if the parts had been showing up!  


Windows – BeatUp-Windows – stress memory and cpu’s

# BeatUp-Windows.ps1 # $psProcess = gps -id $PID $psInstances = (gps -Name $psProcess.name).count if ($psInstances -gt 1) { $psName = “{0}#{1}” -f $psProcess.name,$($psInstances – 1) } else { $psName = $psProcess.name } # RAM in box $box=get-WMIobject Win32_ComputerSystem $Global:physMB=$box.TotalPhysicalMemory / 1024 /1024 ##################### # perfmon counters $Global:psPerfCPU = new-object System.Diagnostics.PerformanceCounter(“Processor”,”% Processor Time”,”_Total”) $Global:psPerfMEM = new-object…

1

SharePoint – AV scanning SharePoint.

Make sure you tell it to ignore your search indexes and other SharePoint areas!See: http://support.microsoft.com/kb/952167 To be sure it is not hitting your index location, you can check where that is currently set by: Central Admin -> Application Management -> Manage service applications   -> Search Service Application ->Search Application Topology (Modify)      -> IndexPartition/Query Component (Edit Properties). Or via…

1

Windows – Get-WindowsUpdateLog

# Get-WindowsUpdateLog.ps1# walk the WindowsUpdate.log to list the # Security Updates that have been installed. # [anything][PatchDate][anything][matchtext][PatchText]$PATTERN  = “([^\n]+\}\t)”$PATTERN += “(?<PatchDate>[0-9]{4}-[0-9]{2}-[0-9]{2})”$PATTERN += “([^\n]+Windows successfully installed the following update:\s)”$PATTERN += “(?<PatchText>[^\n]+)” Function Get-WindowsUpdates($Server) { $WindowsUpdateLogPath = “\\” + $Server + “\Admin$\WindowsUpdate.log” $WindowsUpdateLog = Get-Content $WindowsUpdateLogPath $result = @() ForEach ($line in $WindowsUpdateLog) {   if ($line.Contains(“Windows successfully installed the following update:”))…


SharePoint – import a picture from AD for the user profile

Consider the following scenario.  You have JPG pictures in AD, stored with the users thumbnailPhoto attribute. You try to import pictures for a user profile from the Active Directory thumbnailPhoto attribute,  to store within the Picture attribute in Microsoft SharePoint Server 2010.  You have set up an import Picture URL mapping.  User Profile synch and mysites…

34

PowerShell – add a JPG into AD for the user photo

# Update-AD-Picture.ps1## copy a .jpg into a byte array, then push that into # the “thumbnailPhoto” property of the specified user in AD function UpDate-AD-Picture { param ([STRING] $UserName, [STRING] $JPEGfilePath)  if ( ($JPEGfilePath) -and (test-path($JPEGfilePath)) ) {   [BYTE[]] $JPEG = Get-Content $JPEGfilePath -encoding BYTE     $domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()   $root = $domain.GetDirectoryEntry()     $search = [System.DirectoryServices.DirectorySearcher]…