Skip to main content

Powershell

Go Search
Home
TFS2005
TFS2008
ASP.NET
GRIDVIEW
WCF
MSSQL
SilverLight
JAVA
Flex
JQuery
Powershell
  

> Powershell

 My recent PS scripts

Few usage scripts from my recent powershell
 
My Powershell execution findings for 32-Bit Operating Systems:
 
PS C:\WINDOWS\system32\WindowsPowerShell\v1.0> H:\PROJECTS\PSLIB\Env.ps1
File H:\PROJECTS\PSLIB\Env.ps1 cannot be loaded because the execution of scripts is disable
d on this system. Please see "get-help about_signing" for more details.
At line:0 char:0
 
Reason:
The reason for this error is the security setting on your pc that does not allow you to execute a script.  This is the so-called Execution Policy. By default, the Execution Policy is set to Restricted. This setting means that you may not run any PS1 script at all
 
Restricted: Individual cmdlets can run, but not saved Powershell scripts. This is the default setting
AllSigned: Scripts can run, but must have a digital signature even if written on the local computer. Prompts you before running scripts from trusted publishers.
RemoteSigned: Scripts written on the local computer do not need a digital signature, but any script downloaded from outside (email, IM, Internet) must have a signature to execute. 
Unrestricted: Any script can run, but scripts downloaded from outside will run with a warning.
 
WORKAROUND:

Changing Execution Policy

The best way to set execution policy is to use the Set-ExecutionPolicy cmdlet. Set-ExecutionPolicy has one parameter – executionpolicy which can take one of four values:

Restricted
All Signed
Remote Signed
Unrestricted

Alternatively it is possible to edit the following registry key ExecutionPolicy value as Unrestricted

HKEY_Local_Machine\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.Powershell\ExecutionPolicy  

 
 
 
 
 

 32-Bit/64-Bit

Powershell.exe command line

C:\WINDOWS\system32\WindowsPowerShell\v1.0>powershell.exe

Powershell.exe GUI

C:\WINDOWS\system32\WindowsPowerShell\v1.0>powershell_ise.exe

For 64-bit run both powershell commands from 32bit/64-bit

Set-ExecutionPolicy to /unRestricted

 Links

  Active Directory
  http://www.computerperformance.co.uk/powershell/powershell_active_directory.htm
  powershell-tutorial-introduction/powershell-tutorial-active-directory
  sp ps link
  uploading-documents-to-sharepoint
  sharepoint-and-powershell-practical-tips.aspx
  GetFeatureDefinition.aspx
  powershell-sharepoint.html
  sharepoint-powershell-script-examples
  powershell-script-find-all-sharepoint-features-installed-on-farm.aspx
  ManipulatingRemoteSharePointListsWithPowerShell.aspx
  blog
  stop-and-go-with-sharepoint-2010-on-your-workstation.aspx
  general-powershell-tips-for-sharepoint-gurus-and-powershell-newbies.aspx
  sp ps link 1
  powershell-sharepoint-install-automation
  sharepoint-2010-pre-population-powershell-script.aspx
  Add+Files+to+a+SharePoint+Document+Library+using+PowerShell
  sharepoint 2
  Getting+started+with+PowerShell+and+SharePoint
(More Links...)