Continuing with SharePoint Management Shell

First of all, to echo a point we made a few days ago, our new best friends at Acme Solutions talk about SMS here. They agree that it will be the tool of choice for the SharePoint 2010 administrator.

Then, since we’re still trying to get our feet under us in this environment, we found this from our new best friend, Gary. He confirms we we had said earlier that SMS is just MS PowerShell with SharePoint 2010 library added in and he proves it by looking at the shortcut properties when you right click on Start | Programs |SharePoint 2010 | SharePoint Management Shell.

Here we see the target is just:

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe 
-NoExit  " & ' C:\Program Files\Common Files\Microsoft Shared\
Web Server Extensions\14\CONFIG\POWERSHELL\Registration\
\sharepoint.ps1 ' "

Here we see that the shortcut is just a PowerShell Script of it’s own:

$ver = $host | select version
if ($ver.Version.Major -gt 1)  {$Host.Runspace.ThreadOptions = "ReuseThread"}
Add-PsSnapin Microsoft.SharePoint.PowerShell
Set-location $home

We looked at the Add-PSSnapIn command previously and turns our PowerShell environment into a SharePoint Management Shell environment by adding the microsoft.sharepoint.powershell library. But this also shows us that we can set variables using the $VariableName = Value format.

Prove that to yourself by opening PowerShell and enter:

$robot = "I Love Robots"

and then do:

$robot 

So we’re checked out on setting PowerShell variables.

Finally, the SharePoint.ps1 script includes a largish #sig block of apparently random characters. I presume this has something to do with signing scripts. Recall in our create and delete script that we did last week, we included a   line that said:

Set-ExecutionPolicy RemoteSigned

Now, obviously, I plagerized this from somewhere becasue you all know as much about this or more than I do. And I apologize to my source, whoever you are, because I also try to credit you guys when we benefit from your genius. But, since it’s escaped me, I can only say that I recall reading that this command will allow local scripts to run unsigned but still require remote scripts to have a signature. I’m guessing this big block of characters has something to do with that kind of signature.

hth

-robot


Tags:

 
 
 

Comments are closed.