SharePoint MVP, MCM and Microsoft Press author. @resing on twitter

Archive for the powershell Category

Retrieving Mapped SharePoint Custom Pages from PowerShell

Issue If you’re trying to debug a mapped custom page in SharePoint from PowerShell, but come across this issue: PS C:> $webapp = get-spwebapplication http://sp2010 $webapp.GetMappedPage([Microsoft.SharePoint.Administration.SPWebApplication.SPCustomPage]::Error) Unable to find type [Microsoft.SharePoint.Administration.SPWebApplication.SPCustomPage]: make sure that the assembly containing this type is loaded. At line:2 char:90 + $webapp.GetMappedPage([Microsoft.SharePoint.Administration.SPWebApplication.SPCustomPage] <<<< ::Error) + CategoryInfo : InvalidOperation: (Microsoft.Share…on.SPCustomPage:String) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound Solution Try this instead: $webapp.GetMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::Signout) The Clue I’m not sure why the syntax is different for this. I would have expected […]

Read more

How do you automate FBA web.config changes?

I was asked today by a friend, How do you modify the web.config through a WSP? My quick answer, I don’t! Not if I can avoid it other than the changes made through Visual Studio item properties like safe controls entries and others. However, showing my true consultant nature, I turned the question into the above. That’s a more specific question with a couple good possibilities I’d like to share, but still, it seems like there may be better answers […]

Read more

Creating ADRMS service discovery keys in PowerShell

I’m trying to do more and more with PowerShell lately. I’ve found it’s a really quick way to make changes on Windows Server. Experimenting with Information Rights Management in SharePoint 2013, I needed to create 3 registry keys and set the value of 2. Here’s a script example for setting the Windows Registry keys for client-side ADRMS service discovery: New-Item -Path ‘HKLM:SOFTWAREMicrosoftMSIPCServiceLocation’ New-Item -Path ‘HKLM:SOFTWAREMicrosoftMSIPCServiceLocationEnterprisePublishing’` -value ‘http://adrms.adventureworks.com/_wmcs/licensing/license.asmx’ New-Item -Path ‘HKLM:SOFTWAREMicrosoftMSIPCServiceLocationEnterpriseCertification’` -value ‘http://adrms.adventureworks.com/_wmcs/certification’ If you need to delete a key it’s […]

Read more

FBA Claims Super User Halloween Gotcha

I’ve been working with Claims Authentication a lot recently and I’m still tripped up by some of the basics, it would appear. Yesterday, on Halloween, I received an access denied error on my web application after configuring it for Forms Based Authentication. I had previously migrated it to windows claims, but this was my first try moving an existing web application from windows claims to FBA Claims. The error in the ULS was misleading: Cannot get Role Manager with name […]

Read more

User Profile Property and Property Mapping Troubleshooting

Working with a remote server today, I thought it would be helpful to see some information about the User Profile Properties without being able to see the server. Rather than ask the on site administrator for a bunch of screen shots, I decided to use PowerShell and the SharePoint API. The User Profile Store and a Deprecated Method The first sample code I came across used the deprecated method UserProfileConfigManager.GetProperties. Using this carry over from SharePoint 2007, you can still […]

Read more

Do you have SharePoint PowerShell to SharePoint API translations in your tool belt?

An Old SharePoint API Confusion If you hadn’t seen it before and someone told you there was .Net SharePoint Framework object called SPSite what would you think it was for? It’s commonly used object in SharePoint C# code, and you might think it would represent a SharePoint Site. But it’s not quite that. An SPSite is really a collection of sites. In end user and administration documentation, a collection of sites is commonly referred to as a Site Collection. It’s […]

Read more

PowerShell SharePoint Features Comparison

One example of how PowerShell can help you in your SharePoint migration and upgrade tasks is directory comparison. I’ve used many tools for directory comparison before, but this is hands down the easiest when PowerShell is already installed. In three lines, you have a list of Features installed on one web front end but not the other. PowerShell Basics The solution is based on two out of the box PowerShell commands and one PowerShell principle. Dir command – lists the […]

Read more