Difference between revisions of "Getting Started (PowerShell)"

Jump to navigation Jump to search
m (→‎Installation: Added .NET v4 install link)
(→‎Execution Policy: Minor update)
Line 28: Line 28:
* <code> Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied. </code>
* <code> Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied. </code>


So if you're using Windows 7, for example, you'll need to start the Powershell console as an administrator (right-click ''Run as administrator''), regardless of whether you're currently logged in as an admin).  If you have no admin rights over the PC you're using, then you'll need to select the Suspend option rather than Yes (sets just for your current session, doesn't try to write to the registry).
So if you're using Windows 7, for example, you'll need to start the Powershell console as an administrator (right-click ''Run as administrator''), regardless of whether you're currently logged in as an admin).   
<source lang="powershell"> Set-ExecutionPolicy RemoteSigned </source>
<source lang="powershell"> Set-ExecutionPolicy RemoteSigned </source>
It is possible to bypass the Execution Policy entirely (though you do so at your own risk, should only be used to run a script you trust where you haven't the time to fix the underlying problem, and should be reverted afterwards)...
It is possible to bypass the Execution Policy entirely (though you do so at your own risk, should only be used to run a script you trust where you haven't the time to fix the underlying problem, and should be reverted afterwards)...
<source lang="powershell"> Set-ExecutionPolicy Bypass </source>
<source lang="powershell"> Set-ExecutionPolicy Bypass </source>
'''If you have no admin rights''' over the PC you're using, then can try to use ''Suspend'' option rather than ''Yes'' (sets just for your current session, doesn't try to write to the registry), this doesn't work in all cases.  Alternatively you can hack the Environment variable that controls the Execution Policy (again, this isn't permanent, and may not work in all versions)...
<source lang="powershell">
$env:PSExecutionPolicyPreference = "RemoteSigned"
</source>
To see your current execution policy use...
<source lang="powershell">
Get-ExecutionPolicy
</source>


== Installed Version ==
== Installed Version ==

Navigation menu