Skip to content

Instantly share code, notes, and snippets.

@litodam
Created May 11, 2012 16:02
Show Gist options
  • Save litodam/2660632 to your computer and use it in GitHub Desktop.
Save litodam/2660632 to your computer and use it in GitHub Desktop.
PS1 script to use a starting point
$scriptDir = (split-path $myinvocation.mycommand.path -parent)
Set-Location $scriptDir
#check if the snapin was registered...
if ((Get-PSSnapin -Registered | ?{$_.Name -eq "MySnapin"}) -eq $null) {
Write-Host "SnapIn not installed." -ForegroundColor Red
return
}
if ((Get-PSSnapin | ?{$_.Name -eq "MySnapin"}) -eq $null) {
Add-PSSnapin MySnapin
}
# your stuff here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment