full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/GithubGist/troyhunt_9e1c5094a6eef536804c_raw_d7ad1159b13208669741a830e47066c5f3c186ff_DeleteAzureResources.ps1
troyhunt_9e1c5094a6eef536804c_raw_d7ad1159b13208669741a830e47066c5f3c186ff_DeleteAzureResources.ps1
# Input params $projectName = "TroyPSTest" # Constants $dbServerName = "snyb5o1pxk" $dbServerLogin = "troyhunt" $dbServerPassword = "P@ssw0rd" $apiVersion = "2014-04-01" # Computed vars $dbName = $projectName + "Db" $dbLogin = $dbName + "Login" # Switch over to the resource manager Switch-AzureMode Azu...
PowerShellCorpus/GithubGist/virgilwashere_7157263_raw_5bcb507ec0cbe0b18a1c42b45a72c4304898aae9_breakonexception.ps1
virgilwashere_7157263_raw_5bcb507ec0cbe0b18a1c42b45a72c4304898aae9_breakonexception.ps1
# You can add this line in your profile instead of here... Set-PSBreakpoint -Variable BreakOnException -Mode ReadWriteWrite-Host "Enter"# then just add this where you want to enable breaking on exceptionstrap { $BreakOnException; continue }Write-Host "Starting"throw "stones"Write-Host "Ending"
PowerShellCorpus/GithubGist/jhorsman_8454479_raw_3b6225eb530b597463120780a52107756d357de2_verifyDotNetVersion.ps1
jhorsman_8454479_raw_3b6225eb530b597463120780a52107756d357de2_verifyDotNetVersion.ps1
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version -EA 0 | Where { $_.PSChildName -match '^(?!S)\p{L}'} | Select PSChildName, Version
PowerShellCorpus/GithubGist/sunnyc7_8734060_raw_1f97f5c93e5df8b2400d4647f066449d051bfc4b_Get-InstalledProducts.ps1
sunnyc7_8734060_raw_1f97f5c93e5df8b2400d4647f066449d051bfc4b_Get-InstalledProducts.ps1
#Get MOF File Method $mof = @' #PRAGMA AUTORECOVER [dynamic, provider("RegProv"), ProviderClsid("{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}"),ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")] class SG_InstalledProducts { [key] string KeyName; [read, propertycontext...
PowerShellCorpus/GithubGist/randomvariable_6380009_raw_136a2129f15e414165ae01b56c32b2a6f412ac42_gistfile1.ps1
randomvariable_6380009_raw_136a2129f15e414165ae01b56c32b2a6f412ac42_gistfile1.ps1
# Create a Windows Identity Principal (note the cast) $principal = [Security.Principal.WindowsPrincipal](new-object System.Security.Principal.WindowsIdentity("<username>@<domain>")) # Check if it is a member of a group $princial.IsInRole("<domain>\<group name>") # Other useful things you can do: $identity ...
PowerShellCorpus/GithubGist/rahulrrixe_9496056_raw_86e8734557eb7f45b1e7cae60386559a7fe72167_gistfile1.ps1
rahulrrixe_9496056_raw_86e8734557eb7f45b1e7cae60386559a7fe72167_gistfile1.ps1
(libREST)[rranjan@localhost libcloud.rest]$ python libcloud_rest/server.py Traceback (most recent call last): File "libcloud_rest/server.py", line 101, in <module> main() File "libcloud_rest/server.py", line 97, in main logger=logger, debug=options.debug) File "libcloud_rest/server.py", line 19, in ...
PowerShellCorpus/GithubGist/jjhamshaw_3305817_raw_e989fbb20fdf9099522888f70fb4e84d91af2fda_gistfile1.ps1
jjhamshaw_3305817_raw_e989fbb20fdf9099522888f70fb4e84d91af2fda_gistfile1.ps1
task BackupTestToQaDatabase { try { Invoke-Sqlcmd -InputFile $copySqlDatabase -ServerInstance $sqlserver -Database $databaseToBackUp -Username $databaseUsername -Password $databasePassword -QueryTimeout 240 -ErrorAction 'Stop' } catch { '##teamcity[buildStatus status='FAILURE' text='Build Failed']' } } ...
PowerShellCorpus/GithubGist/idavis_3314814_raw_f8a011c622ffdb63d6fc9579c7fbce525625d986_Get-Distance.ps1
idavis_3314814_raw_f8a011c622ffdb63d6fc9579c7fbce525625d986_Get-Distance.ps1
$point = new-object psobject $point | Add-Member NoteProperty -Name X -Value 4 $point | Add-Member NoteProperty -Name Y -Value 0 $point2 = new-object psobject $point2 | Add-Member NoteProperty -Name X -Value 0 $point2 | Add-Member NoteProperty -Name Y -Value 0 function Get-Distance { param( [Paramet...
PowerShellCorpus/GithubGist/dfrencham_605cdcc653f07bdd5a79_raw_c2b86d43b5228a65cb312b81b092f952a656079b_gistfile1.ps1
dfrencham_605cdcc653f07bdd5a79_raw_c2b86d43b5228a65cb312b81b092f952a656079b_gistfile1.ps1
# One liner! # Finds all duplicate CSS classes in a CSS file, and ignores hex colour codes (the #DDDDDD pattern would be a false positve) Get-Content .\filename.css | ForEach-Object { $_.Split(" ,.", [System.StringSplitOptions]::RemoveEmptyEntries) } | ForEach-Object { $_.Trim() } | where { ($_[0] -eq "#" -or $_[0] -...
PowerShellCorpus/GithubGist/plioi_5359834_raw_60dce0bbb77f484e197c9b140a8a99a2673ed77e_gistfile1.ps1
plioi_5359834_raw_60dce0bbb77f484e197c9b140a8a99a2673ed77e_gistfile1.ps1
task Package -depends xUnitTest { rd .\package -recurse -force -ErrorAction SilentlyContinue | out-null mkdir .\package -ErrorAction SilentlyContinue | out-null exec { & $src\.nuget\NuGet.exe pack $src\$project\$project.csproj -Symbols -Prop Configuration=$configuration -OutputDirectory .\package } ...
PowerShellCorpus/GithubGist/joshtransient_5984592_raw_1375357910aff3cc8e8445ea8e2f08627eee4c4e_Convert-HashtableXML.ps1
joshtransient_5984592_raw_1375357910aff3cc8e8445ea8e2f08627eee4c4e_Convert-HashtableXML.ps1
$tr = New-Object system.Xml.XmlTextReader("c:\metrics\scripts\out.xml") $tw = New-Object system.Xml.XmlTextWriter("c:\metrics\scripts\fullmig.xml",$null) $tw.WriteStartDocument() # Our document will resemble something like this: ############ # <Objects> # <Object> # <!-- Scenario 1: regular key/value --> #...
PowerShellCorpus/GithubGist/n-fukuju_8487441_raw_397ce52f2951f1e8edb2b6c510b397ac82766825_getlogonuser.ps1
n-fukuju_8487441_raw_397ce52f2951f1e8edb2b6c510b397ac82766825_getlogonuser.ps1
$target = "対象のホスト名か、IPアドレス" $logonUser = (Get-WmiObject Win32_ComputerSystem -ComputerName $target).UserName # リモートアクセスの資格情報を明示的に指定する場合 $admin = "ユーザ名" $pass = "パスワード" $securePass = ConvertTo-SecureString -String $pass -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential($adm...
PowerShellCorpus/GithubGist/Iristyle_1672426_raw_d06e4115d80eed71e45e2efdec4949fb4e741c7e_Bootstrap-EC2-Windows-CloudInit.ps1
Iristyle_1672426_raw_d06e4115d80eed71e45e2efdec4949fb4e741c7e_Bootstrap-EC2-Windows-CloudInit.ps1
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM # AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing. # Then use the EC2 tools to create a new AMI from the result, and you have a system # that will execute user-data as a PowerShell script after the insta...
PowerShellCorpus/GithubGist/aqr_5139945_raw_91c07ddcda380100122340d0853a64a321bc2a7f_icontrol.ps1
aqr_5139945_raw_91c07ddcda380100122340d0853a64a321bc2a7f_icontrol.ps1
# init $success = if ((Get-PSSnapin | Where { $_.Name -eq "iControlSnapIn"}) -eq $null) { Add-PSSnapIn iControlSnapIn } # profile $profile = new-object -typename iControl.LocalLBVirtualServerVirtualServerProfile $profile.profile_context = "PROFILE_CONTEXT_TYPE_ALL" $profile.profile_name = "http-xff"
PowerShellCorpus/GithubGist/chgeuer_8342314_raw_683639c5f084d0c3f3c8709efcb74c237948bca6_Install-Erlang.ps1
chgeuer_8342314_raw_683639c5f084d0c3f3c8709efcb74c237948bca6_Install-Erlang.ps1
# # Check if Erlang is installed # $erlangkey = Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Ericsson\Erlang -ErrorAction SilentlyContinue if ( $erlangkey -eq $null ) { Write-Host "Erlang not found, need to install it" Start-Process -Wait otp_win64_R16B03.exe /S } # # Determine Erlang home path # $ERLANG_HO...
PowerShellCorpus/GithubGist/jquintus_b9ad19e94b3842b0d15e_raw_01d3cc9d7ced199b8e3a6ecd39b88724dd9d77eb_Disable_Hyper-V.ps1
jquintus_b9ad19e94b3842b0d15e_raw_01d3cc9d7ced199b8e3a6ecd39b88724dd9d77eb_Disable_Hyper-V.ps1
# This script makes a copy of the current boot record and disables Hyper-V # The next time the computer is restarted you can elect to run without Hyper-V $output = invoke-expression 'bcdedit /copy "{current}" /d "Hyper-V Disabled"' $output -match '{.*}' $guid = $matches[0] $hyperVCommand = 'bcdedit /set "' + $g...
PowerShellCorpus/GithubGist/vintem_6334646_raw_30116f16c82c65b3f8b40523b07c57fad32d35e2_dev_setup.ps1
vintem_6334646_raw_30116f16c82c65b3f8b40523b07c57fad32d35e2_dev_setup.ps1
function Add-Path() { [Cmdletbinding()] param([parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)][String[]]$AddedFolder) # Get the current search path from the environment keys in the registry. $OldPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro...
PowerShellCorpus/GithubGist/richjenks_5933149_raw_7bf34075db815597b33d3f53db95b470718f0519_batch-rename-files.ps1
richjenks_5933149_raw_7bf34075db815597b33d3f53db95b470718f0519_batch-rename-files.ps1
# Replace underscores with hyphens Dir | Rename-Item –NewName { $_.name –replace "_","-" }
PowerShellCorpus/GithubGist/mbrownnycnyc_c488b4f8885d0f51b97a_raw_c8b284a92e3f68cb7049f05e0ac3110bfad27a48_Invoke-CommandAgainstOU.ps1
mbrownnycnyc_c488b4f8885d0f51b97a_raw_c8b284a92e3f68cb7049f05e0ac3110bfad27a48_Invoke-CommandAgainstOU.ps1
#ref ## http://blogs.technet.com/b/heyscriptingguy/archive/2011/06/13/use-powershell-invoke-command-for-remoting.aspx ## http://www.powershellmagazine.com/2013/04/10/pstip-wait-for-a-service-to-reach-a-specified-status/ ## http://stackoverflow.com/a/3008717/843000 ## http://support.microsoft.com/kb/2509997 Invok...
PowerShellCorpus/GithubGist/gsmiro_8022175_raw_0935bce3cf8ec342336a941caede07d7557d1901_powershell-utils.ps1
gsmiro_8022175_raw_0935bce3cf8ec342336a941caede07d7557d1901_powershell-utils.ps1
#Check path $env:Path #set path $env:Path += "<path>" #location of profile.ps1 file: ~\Documents\WindowsPowerShell
PowerShellCorpus/GithubGist/vgrem_7552775_raw_89ed825739ef646ff61c0bc73b39a67bebefd06f_ClientRuntimeContext.Load.ps1
vgrem_7552775_raw_89ed825739ef646ff61c0bc73b39a67bebefd06f_ClientRuntimeContext.Load.ps1
Function Invoke-LoadMethod() { param( $ClientObject = $(throw "Please provide an Client Object instance on which to invoke the generic method") ) $ctx = $ClientObject.Context $load = [Microsoft.SharePoint.Client.ClientContext].GetMethod("Load") $type = $ClientObject.GetType() $clientObjectLoad =...
PowerShellCorpus/GithubGist/Restuta_2512835_raw_de75f4fb11117bcd9dec349a0b34670e15ccb42e_setup-git-ex.ps1
Restuta_2512835_raw_de75f4fb11117bcd9dec349a0b34670e15ccb42e_setup-git-ex.ps1
$os=Get-WMIObject win32_operatingsystem if ($os.OSArchitecture -eq "64-bit") { $gitInstallationDir = "c:\Program Files (x86)\Git\" } else { $gitInstallationDir = "c:\Program Files\Git\" } #adding git installation directory to PATH variable if (-not $env:Path.Contains($gitInstallationDir)) { Write-Host "...
PowerShellCorpus/GithubGist/guitarrapc_5829075186342d3ca143_raw_66734539a2085498c89e680bde3bc21e56916cba_ACLExecution.ps1
guitarrapc_5829075186342d3ca143_raw_66734539a2085498c89e680bde3bc21e56916cba_ACLExecution.ps1
ACLTest -OutputPath ACLTest Start-DscConfiguration -Wait -Force -Verbose -Path ACLTest
PowerShellCorpus/GithubGist/goo32_d33e2dc04b29e773eb32_raw_92920fbef205420ae4e23e5130b49e3e0c0c2d36_random_image_count.ps1
goo32_d33e2dc04b29e773eb32_raw_92920fbef205420ae4e23e5130b49e3e0c0c2d36_random_image_count.ps1
ls | ?{ $_.PSIsContainer } | Get-Random | gci -filter *.jpg -recurse | Measure-Object
PowerShellCorpus/GithubGist/r-plus_304fefcad63834ded16e_raw_97dcaa402da6edc100f46b67ce31f36a6ef24c63_matcher.ps1
r-plus_304fefcad63834ded16e_raw_97dcaa402da6edc100f46b67ce31f36a6ef24c63_matcher.ps1
$json = @" { "matcher": [ { "regexp" : "^re$", "dest" : "dest1" }, { "regexp" : "^h\\w+eほげ.{3}我$", "dest" : "dest2" }, { "regexp" : ".*", "dest" : "dest3" } ] } "@ | Conv...
PowerShellCorpus/GithubGist/sksbrg_2699702_raw_965c923a529e49c50bd58e72744ce688999561ba_git_svn__add_remote_branch.ps1
sksbrg_2699702_raw_965c923a529e49c50bd58e72744ce688999561ba_git_svn__add_remote_branch.ps1
# Change the following 3 lines for your needs before executing the batch $svnBranch = "remote_branch_name" # The branch name used in SVN $gitBranch = "local_branch_name" # The branch name you like to see in local git-svn $branchUrl = "http://full/path/to/branches/" + $svnBranch # ---- this is where the automation...
PowerShellCorpus/GithubGist/krote_4975388_raw_9a84842b647de25ba81550c67c156432e1217efc_classutil.ps1
krote_4975388_raw_9a84842b647de25ba81550c67c156432e1217efc_classutil.ps1
# classutil.ps1 # source from http://mojibake.seesaa.net/article/56484188.html # class to cls # var to mem # def to func $global:__cls__=@{} # this function is not worked. why... function global:cls([string] $name, [ScriptBlock] $definition) { $global:__cls__[$name] = $definition } function global:...
PowerShellCorpus/GithubGist/adams-sarah_03097fc9275c04575e24_raw_e3075d14072cd4a10feccaaea05f71212208b926_windows-2003.ps1
adams-sarah_03097fc9275c04575e24_raw_e3075d14072cd4a10feccaaea05f71212208b926_windows-2003.ps1
cd C:\Documents and Settings\Administrator mkdir Programs bitsadmin /transfer pythondownloadjob /download /priority normal https://www.python.org/ftp/python/3.4.1/python-3.4.1.msi C:\Documents and Settings\Administrator\Programs\python-3.4.1.msi cd Programs msiexec /quiet /i python-3.4.1.msi setx PATH "%PATH%;C:\Pytho...
PowerShellCorpus/GithubGist/miwaniza_9164083_raw_e52ed4d9cdb4611df572b256bc1e3bb27c878516_getall_groups.ps1
miwaniza_9164083_raw_e52ed4d9cdb4611df572b256bc1e3bb27c878516_getall_groups.ps1
Add-Type -Path "C:\Program Files (x86)\Autodesk\Autodesk Vault 2014 SDK\bin\Autodesk.Connectivity.WebServices.dll" $cred = New-Object Autodesk.Connectivity.WebServicesTools.UserPasswordCredentials ("localhost","Vault","Administrator","",$true) $webSvc = New-Object Autodesk.Connectivity.WebServicesTools.WebServiceMana...
PowerShellCorpus/GithubGist/jstangroome_2865415_raw_39aa8dccbf97d026c55da29f920e6bca868bfc64_Export-TfsCollection.ps1
jstangroome_2865415_raw_39aa8dccbf97d026c55da29f920e6bca868bfc64_Export-TfsCollection.ps1
[CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $ServerUrl, [Parameter(Mandatory=$true)] [string] $Name, [Parameter(Mandatory=$true)] [string] $ExportPath ) function Get-Collection ( $ConfigurationServer, $Name ) { $CollectionService ...
PowerShellCorpus/GithubGist/zerhacken_11008917_raw_33a9e9b4379eec6fbdec76d836ee73f59d2ddc9b_profile.ps1
zerhacken_11008917_raw_33a9e9b4379eec6fbdec76d836ee73f59d2ddc9b_profile.ps1
# Set environment variables for Visual Studio Command Prompt pushd 'c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC' cmd /c "vcvarsall.bat&set" | foreach { if ($_ -match "=") { $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" } } popd write-host "`nVisual Studio 2013 ...
PowerShellCorpus/GithubGist/zippy1981_854911_raw_eeeb41326c4186a0d14ac6b724e2db34744e21a8_MongoTest.ps1
zippy1981_854911_raw_eeeb41326c4186a0d14ac6b724e2db34744e21a8_MongoTest.ps1
# We assume that the driver is installed via the MSI. [string] $mongoDriverPath; # Check to see if we are running the 64 bit version of Powershell. # See http://stackoverflow.com/questions/2897569/visual-studio-deployment-project-error-when-writing-to-registry if ([intptr]::size -eq 8) { $mongoDriverPath = ...
PowerShellCorpus/GithubGist/organicit_5057402_raw_2c3ef0fb84d4a0b8a3ff48233f389f0f2b619a3b_gistfile1.ps1
organicit_5057402_raw_2c3ef0fb84d4a0b8a3ff48233f389f0f2b619a3b_gistfile1.ps1
'010.10.005.012' -replace '\b0*','' #returns 10.10.005.012 reference 2/28/2013 powershell.com email tip
PowerShellCorpus/GithubGist/lantrix_1e34ed4a1be1f2507dff_raw_87b6689a333698ee6b7cd04e8c44244b4e900bf5_throw_example.ps1
lantrix_1e34ed4a1be1f2507dff_raw_87b6689a333698ee6b7cd04e8c44244b4e900bf5_throw_example.ps1
try { throw "exception has occured! Failure text" } catch { #Catch throw test $throwError = $_ } finally { if ([bool]$throwError) { Write-Host "$throwError" } else { Write-Host "Finished Successfully" } }
PowerShellCorpus/GithubGist/acaire_4172880_raw_0a874461c6791fb17663a0ef84adbe0eb23812d8_Bootstrap-EC2-Windows-CloudInit.ps1
acaire_4172880_raw_0a874461c6791fb17663a0ef84adbe0eb23812d8_Bootstrap-EC2-Windows-CloudInit.ps1
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM # AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing. # Then use the EC2 tools to create a new AMI from the result, and you have a system # that will execute user-data as a PowerShell script after the instance...
PowerShellCorpus/GithubGist/pohatu_e00c63db11fb173674c5_raw_be475cc4e22e5efc772bc4e7ca8817f7fdf71550_Get-FavoritesFQDN.ps1
pohatu_e00c63db11fb173674c5_raw_be475cc4e22e5efc772bc4e7ca8817f7fdf71550_Get-FavoritesFQDN.ps1
# This can help you detect which shortcuts from IE are internal or external # you may want to migrate/backup/sync https://gist.github.com/pohatu but not # something like http://secret/internal/site # madprops to madprops for below snippet #http://madprops.org/blog/list-your-favorites-in-powershell/ $favs = gci...
PowerShellCorpus/GithubGist/jeff-french_2351828_raw_178b5c0a8c70f9119dbf49a0edfd7cd23857c868_profile.ps1
jeff-french_2351828_raw_178b5c0a8c70f9119dbf49a0edfd7cd23857c868_profile.ps1
# Add Git bin directory to path for this session $env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"
PowerShellCorpus/GithubGist/minakuchiya_5459119_raw_025ad025c86b63af08a8a7553358f41a9826531e_AutoLogin.ps1
minakuchiya_5459119_raw_025ad025c86b63af08a8a7553358f41a9826531e_AutoLogin.ps1
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") function login { $process = @(ps | where {$_.ProcessName -eq ‘MyApp’} | select ProcessName) if($process.count -eq 0) { ii "C:\MyApp.exe" sleep 1 [System.Windows.Forms.SendKeys]::SendWait("{S}{Y}{S}{T}{E}{M}") [System.W...
PowerShellCorpus/GithubGist/pkirch_809d5102b6d16bbd7c0c_raw_740576861e9ba625253c1ce4171e9307b0b76a65_AzurePowerShellModul.ps1
pkirch_809d5102b6d16bbd7c0c_raw_740576861e9ba625253c1ce4171e9307b0b76a65_AzurePowerShellModul.ps1
Get-Module -Name Azure -ListAvailable <# Output Verzeichnis: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement ModuleType Version Name ExportedCommands ...
PowerShellCorpus/GithubGist/lantrix_d868e56b4cbce7349ea8_raw_823c74f4625d5ef4b5de00d446317ff2cffe7945_create_spanned_drive.ps1
lantrix_d868e56b4cbce7349ea8_raw_823c74f4625d5ef4b5de00d446317ff2cffe7945_create_spanned_drive.ps1
$disks = (wmic diskdrive list brief | measure-object -line | select -ExpandProperty Lines)-2 #1.. $disks | ForEach-Object -Begin {$a = $null} -Process { ` $a += $("select disk "+$_+[char][int](13)+[char][int](10)) ; ` $a += "online disk noerr "+[char][int](13)+[char][int](10) ; ` $a += "clean "+[char][int](13...
PowerShellCorpus/GithubGist/geoyogesh_5bb7057f7550ee1b90d3_raw_7e9c21b5de57ba320c6c1f81695b8de145007f1b_gistfile1.ps1
geoyogesh_5bb7057f7550ee1b90d3_raw_7e9c21b5de57ba320c6c1f81695b8de145007f1b_gistfile1.ps1
# Revert changes to modified files. git reset --hard # Remove all untracked files and directories. git clean -fd
PowerShellCorpus/GithubGist/whataride_7638195_raw_992cf90c0e8e0d89e2e4c80c036956a064a021de_host.ps1
whataride_7638195_raw_992cf90c0e8e0d89e2e4c80c036956a064a021de_host.ps1
# more information can be found here: # http://stackoverflow.com/questions/1825585/how-to-determine-what-version-of-powershell-is-installed $host # sample output: # Name : Windows PowerShell ISE Host # Version : 2.0 # InstanceId : 25068e2e-0d9a-4df6-a913-17c462899502 # UI ...
PowerShellCorpus/GithubGist/sandcastle_78dcba3c8e9e6910fb12_raw_b64f937fdfac1cb6ea2a77cb729b11e13f184a49_clean.ps1
sandcastle_78dcba3c8e9e6910fb12_raw_b64f937fdfac1cb6ea2a77cb729b11e13f184a49_clean.ps1
Get-ChildItem .\ -include bin,obj,_ReSharper* -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
PowerShellCorpus/GithubGist/mendel129_6809737_raw_1128777b24fd455c3b8e514ee2e6b500c6146690_gistfile1.ps1
mendel129_6809737_raw_1128777b24fd455c3b8e514ee2e6b500c6146690_gistfile1.ps1
$RPC =Get-Counter "\MSExchange RpcClientAccess\User Count" -computername "srv1" $OWA =Get-Counter "\MSExchange OWA\Current Unique Users" -computername "srv1" $POP = Get-Counter "\MSExchangePop3(1)\Connections Current" -ComputerName "srv1" $IMAP = get-counter "\MSExchangeImap4(1)\Current Connections" -ComputerName "s...
PowerShellCorpus/GithubGist/fr0gger03_b9136768a85a7d1b4321_raw_e930126cb2914b0c4bd84564c554740ea428f966_VM-to-VMFS.ps1
fr0gger03_b9136768a85a7d1b4321_raw_e930126cb2914b0c4bd84564c554740ea428f966_VM-to-VMFS.ps1
# you must connect and authenticate to a vCenter server # use Connect-VIServer to do so # establish Export file name $csvname = Read-Host 'Please provide the file path and name for your CSV export' # Gather information on all datacenters and datastores, then enter loop Get-Datacenter | Get-Datastore | Foreac...
PowerShellCorpus/GithubGist/joshua_5446846_raw_5bb4f59e4339e444e5324aeb2cea8e1e65ef1b54_Microsoft.PowerShell_profile.ps1
joshua_5446846_raw_5bb4f59e4339e444e5324aeb2cea8e1e65ef1b54_Microsoft.PowerShell_profile.ps1
# Default PowerShell Profile # # ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 # # Remote script execution must be enabled. # Get-ExecutionPolicy should return RemoteSigned or Unrestricted # # If no, run the following as Administrator: # Set-ExecutionPolicy RemoteSigned -Scope CurrentUs...
PowerShellCorpus/GithubGist/philoushka_08d58dce415201ffabd1_raw_e584300fc1f5963c44afa952f9dbd99ef5325b3b_NewEventLog.ps1
philoushka_08d58dce415201ffabd1_raw_e584300fc1f5963c44afa952f9dbd99ef5325b3b_NewEventLog.ps1
#set permissions for the event log; read and write to the EventLog key and its subkeys and values. $acl= get-acl -path "HKLM:\SYSTEM\CurrentControlSet\Services\EventLog" $inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit" $propagation = [system.security.accesscontrol.Propagat...
PowerShellCorpus/GithubGist/josheinstein_9898245_raw_c042da6b60fb944f99e87d185c70f96589406ff1_Export-Excel.ps1
josheinstein_9898245_raw_c042da6b60fb944f99e87d185c70f96589406ff1_Export-Excel.ps1
#.SYNOPSIS # Exports objects to an Excel spreadsheet by writing them to a temporary # CSV file and using Excel automation model to import it into a workbook. # This allows formatting to be applied to columns which would not otherwise # be possible in a plain CSV export. function Export-Excel { [CmdletBindin...
PowerShellCorpus/GithubGist/fe80Grau_9682010_raw_094de5212a67e0e606b529150f664bef764d0d12_ADDS.ps1
fe80Grau_9682010_raw_094de5212a67e0e606b529150f664bef764d0d12_ADDS.ps1
import-csv .usuarios.csv | foreach-object{ ## ---> primera variable del dominio para crear las ou en primer nivel (si es necesario) $dominio = [ADSI]"LDAP://DC=dominio,DC=org" ## ---> segunda variable de dominio para crear los objetos dentro de la OU que sea necesaria $dominiog = [ADSI]"LDAP://OU=$(...
PowerShellCorpus/GithubGist/michischatz_81ab5f290b6c608f7209_raw_0d28ed19f0e5ae389231273b85b296622d26c6b9_Logging_Functions.ps1
michischatz_81ab5f290b6c608f7209_raw_0d28ed19f0e5ae389231273b85b296622d26c6b9_Logging_Functions.ps1
Function Log-Start{ <# .SYNOPSIS Creates log file .DESCRIPTION Creates log file with path and name that is passed. Checks if log file exists, and if it does deletes it and creates a new one. Once created, writes initial logging data .PARAMETER LogPath Mandatory. Path of where log is ...
PowerShellCorpus/GithubGist/stefanwalther_81ce696d0a8dac05dfa9_raw_30a57f2ef6ec495a696a4c05e6f811799b4cfd41_Backup_MongoDB.ps1
stefanwalther_81ce696d0a8dac05dfa9_raw_30a57f2ef6ec495a696a4c05e6f811799b4cfd41_Backup_MongoDB.ps1
$date = Get-Date -UFormat %Y-%m-%d; $backupFolder = $date; $basePath = "C:\bla"; $destinationPath = Join-Path $basePath $backupFolder; if(!(Test-Path -Path $destinationPath)) { New-Item -ItemType directory -Path $destinationPath; (C:\mongodb\bin\mongodump.exe --out $destinationPath); }
PowerShellCorpus/GithubGist/VertigoRay_7b73da2cace3d49a2cf2_raw_99ca60ed53c1ad44e4454f7d2ca31b6a5349663e_CatchLineNumbers.ps1
VertigoRay_7b73da2cace3d49a2cf2_raw_99ca60ed53c1ad44e4454f7d2ca31b6a5349663e_CatchLineNumbers.ps1
function a { param( [string]$UninstallString = 'thing' ) $MyInvocation Write-Host -Fore Cyan "$($here.File) $($MyInvocation.MyCommand):$($MyInvocation.ScriptLineNumber)" b try { Throw('Thing!!!!') } catch { Write-Host -Fore Magenta ("{0} {1}:{2}: ErRaWr!! ...
PowerShellCorpus/GithubGist/johnmiller_50fd88f950dbf367d5cf_raw_de16a9625a44b35b5e4e8319d6dd5635e09303ae_clone-all-repositories.ps1
johnmiller_50fd88f950dbf367d5cf_raw_de16a9625a44b35b5e4e8319d6dd5635e09303ae_clone-all-repositories.ps1
$Workspace = "C:\Workspace\" function create-command($dir) { $ProjDir = $Workspace + $dir $GitDir = $ProjDir + "\.git" $Config = $GitDir + "\config" $IsRepository = Test-Path $GitDir if (!$IsRepository) { return } $RemoteUrl = git config -f $Config --get remote.origin.url cd $ProjDir $Cu...
PowerShellCorpus/GithubGist/wishi_255625_raw_0ccf27cc76cb785d2682330a152824b70eac92c3_ssh-agent-utils.ps1
wishi_255625_raw_0ccf27cc76cb785d2682330a152824b70eac92c3_ssh-agent-utils.ps1
# SSH Agent Functions # Mark Embling (http://www.markembling.info/) # # How to use: # - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice) # - Import into your profile.ps1: # e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes] # - Enjoy...
PowerShellCorpus/GithubGist/healeyio_fac1ba9672a1807b6104_raw_7d57d20d7ebfd497ab6dfd22744202d66b811942_Set-LyncNoteWithTwitter.ps1
healeyio_fac1ba9672a1807b6104_raw_7d57d20d7ebfd497ab6dfd22744202d66b811942_Set-LyncNoteWithTwitter.ps1
#requires –Version 3.0 <# .SYNOPSIS Sets Lync 2013 Client's PersonalNote field with latest tweet from your favorite twitter personality: @SwiftOnSecurity .DESCRIPTION What's happening today? Find out with the Set-LyncNoteWithTwitter.ps1 script. It sets the Lync 2013 Client's personal note to match the latest...
PowerShellCorpus/GithubGist/RobinNilsson_2420987_raw_1394e83b487904ff850eb4ba4fcedcdb2bc98bbf_gistfile1.ps1
RobinNilsson_2420987_raw_1394e83b487904ff850eb4ba4fcedcdb2bc98bbf_gistfile1.ps1
$whatever $opt = [GenericUriParserOptions]::GenericAuthority $parser = new-object system.GenericUriParser $opt if (![UriParser]::IsKnownScheme("whatever")) { [UriParser]::Register($parser,"/" $whatever,-1) } new-object system.uri("http:localhost:7080")
PowerShellCorpus/GithubGist/jm-welch_6198171_raw_f9cc71fa0ed373fc1963a18b85610aa670ab681e_Send-MailMessages.ps1
jm-welch_6198171_raw_f9cc71fa0ed373fc1963a18b85610aa670ab681e_Send-MailMessages.ps1
function Send-MailMessages { <# .SYNOPSIS Send a batch of emails very quickly. .DESCRIPTION This script is designed to assist in generating email messages for testing internal/external message flow for your messaging infrastructure. The ability to quickly send a batch of messages wit...
PowerShellCorpus/GithubGist/mlhDevelopment_f84f7297131705a63191_raw_030b95afdce4b4444e8870881e95dcc57b06df4f_gistfile1.ps1
mlhDevelopment_f84f7297131705a63191_raw_030b95afdce4b4444e8870881e95dcc57b06df4f_gistfile1.ps1
# Rotates a vertical set similar to an Excel PivotTable # # Given $data in the format: # # Category Activity Duration # ------------ ------------ -------- # Management Email 1 # Management Slides 4 # Project A Email 2 # Project A Research 1 # Project B Re...
PowerShellCorpus/GithubGist/bcatcho_4531873_raw_df131f2bcf525f28c9de7f2eef4e90a884643c40_CompileForAzure.ps1
bcatcho_4531873_raw_df131f2bcf525f28c9de7f2eef4e90a884643c40_CompileForAzure.ps1
& ("C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe") /nologo ` ../Ask3Cloud/Ask3Cloud.sln ` /p:SkipInvalidConfigurations=true ` /p:TargetProfile="Dev" ` /t:"publish;Build" ` /p:Configuration="Release" ` /p:Platform="Any CPU" ` /p:RunCodeAnalysis="False" ` /v:minimal ...
PowerShellCorpus/GithubGist/Pampus_d6ba7c400b92ee60fbdd_raw_1b655e6f73bea4126c270c09468a750bba0f9674_importSjisCsv.ps1
Pampus_d6ba7c400b92ee60fbdd_raw_1b655e6f73bea4126c270c09468a750bba0f9674_importSjisCsv.ps1
Get-Content <filepath> | ConvertFrom-Csv
PowerShellCorpus/GithubGist/selfcommit_9139532_raw_8d9b38aa20f25b5f61c291eae8d611cec5565163_view.ps1
selfcommit_9139532_raw_8d9b38aa20f25b5f61c291eae8d611cec5565163_view.ps1
############################################################################ # Scriptname: Pool_Prov.ps1 # Description: Checks against ADAM for Pool Status # By: Adam Baldwin # Edited for Hillsborough Township Public Schools by Dan O'Boyle # Usage: Use this script to check whether any pools are in a non-provisioni...
PowerShellCorpus/GithubGist/sopelt_ed8315998f3105c2a7a5_raw_e23732df4d39d70cc131ffe24f8fb74b7d3d265d_PrintAzureServiceVersions.ps1
sopelt_ed8315998f3105c2a7a5_raw_e23732df4d39d70cc131ffe24f8fb74b7d3d265d_PrintAzureServiceVersions.ps1
# based on http://blogs.msdn.com/b/wats/archive/2014/05/19/how-to-determine-current-guest-os-family-only-for-pass-instance-web-role-and-worker-role-windows-azure-powershell.aspx # # setup Azure publish settings according to http://blogs.msdn.com/b/wats/archive/2013/02/18/windows-azure-powershell-getting-started.aspx...
PowerShellCorpus/GithubGist/blakmatrix_3026832_raw_a482692f53872ae5892b46babb207ec6e77538b4_gistfile1.ps1
blakmatrix_3026832_raw_a482692f53872ae5892b46babb207ec6e77538b4_gistfile1.ps1
PS C:\Users\fred rosak> cd .\projects PS C:\Users\fred rosak\projects> jitsu install path.existsSync is now called `fs.existsSync`. info: Welcome to Nodejitsu blakmatrix info: It worked if it ends with Nodejitsu ok info: Executing command install help: The install command downloads pre-built node applic...
PowerShellCorpus/GithubGist/tugberkugurlu_a330503930565bbae4e1_raw_073750edf56055af3376d2a7fe17234eb7f845c8_build.ps1
tugberkugurlu_a330503930565bbae4e1_raw_073750edf56055af3376d2a7fe17234eb7f845c8_build.ps1
param( $buildFile = (join-path (Split-Path -parent $MyInvocation.MyCommand.Definition) "build.msbuild"), $buildParams = "/p:Configuration=Release", $buildTarget = "/t:Default" ) & "${env:ProgramFiles(x86)}\MSBuild\14.0\Bin\MSBuild.exe" $buildFile $buildParams $buildTarget /verbosity:diagnostic
PowerShellCorpus/GithubGist/thedrow_5518156_raw_45bb26d9259da4ac23edb33f32fc66ddb7a1647a_gistfile1.ps1
thedrow_5518156_raw_45bb26d9259da4ac23edb33f32fc66ddb7a1647a_gistfile1.ps1
cinst poshgit Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm
PowerShellCorpus/GithubGist/aigarsdz_6071059_raw_851de9e25326a440c32f0f5cd15bf7f9281ba836_create.ps1
aigarsdz_6071059_raw_851de9e25326a440c32f0f5cd15bf7f9281ba836_create.ps1
param ( # A user has to provide the post title as a -Post parameter in order # for script to work. [string]$post = $(throw "-post is required") ) # Convert any text to a URL friendly string. # # $title - String to convert. # # Examples: # # parameterize("Šis ir gadījuma teksts!") # #=> sis-ir-gadijuma-tekst...
PowerShellCorpus/GithubGist/obscuresec_df5f652c7e7088e2412c_raw_3aa76e30b3d08f236a42a83bbcfdaf20f71c6044_gistfile1.ps1
obscuresec_df5f652c7e7088e2412c_raw_3aa76e30b3d08f236a42a83bbcfdaf20f71c6044_gistfile1.ps1
function Test-SmbPassword { <# .SYNOPSIS Tests a username and password to see if it is valid against a remote machine or domain. Author: Chris Campbell (@obscuresec) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None Version: 0.1.0 .DESCRIPTION T...
PowerShellCorpus/GithubGist/Jiangtang_5420439_raw_404dca8f1cd0af628e62d4b1723060e90d6506fe_SasMetadataGetColumns.ps1
Jiangtang_5420439_raw_404dca8f1cd0af628e62d4b1723060e90d6506fe_SasMetadataGetColumns.ps1
# SasMetadataGetColumns.ps1 # Example usage: # For table grid display, use: # .\SasMetadataGetColumns.ps1 | Out-Gridview # For export to CSV # .\SasMetadataGetColumns.ps1 | Export-Csv -Path "c:\output\cols.csv" -NoTypeInformation # ------------------------------------------------------------------- # creat...
PowerShellCorpus/GithubGist/piers7_6432985_raw_9a5c62dbf11794b8214601d093401d1951d334a7_Load-TeamCityProperties.ps1
piers7_6432985_raw_9a5c62dbf11794b8214601d093401d1951d334a7_Load-TeamCityProperties.ps1
<# .Synopsis Loads TeamCity system build properties into the current scope Unless forced, doesn't do anything if not running under TeamCity #> param( $prefix = 'TeamCity.', $file = $env:TEAMCITY_BUILD_PROPERTIES_FILE + ".xml", [switch] $inTeamCity = (![String]::IsNullOrEmpty($env:TEAMCITY_VERSION)) ...
PowerShellCorpus/GithubGist/dfinke_5182497_raw_d799777e9e8aded409527c2baaafabe3edc48d74_IseNode.ps1
dfinke_5182497_raw_d799777e9e8aded409527c2baaafabe3edc48d74_IseNode.ps1
$sb = { $node = "node.exe" if(!(Get-Command $node -ErrorAction SilentlyContinue)) { throw "Could not find $node" } $psISE.CurrentFile.Save() & $node $psISE.CurrentFile.FullPath } $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("Invoke Node", $sb, "CTRL+F6")
PowerShellCorpus/GithubGist/timparkinson_3851325_raw_27ffae38589369a620001643b37afc506e45782c_LoadConfig.ps1
timparkinson_3851325_raw_27ffae38589369a620001643b37afc506e45782c_LoadConfig.ps1
# LoadConfig.ps1 # # Simplified method of maintaining module specific configuration files. # Based on: http://rkeithhill.wordpress.com/2006/06/01/creating-and-using-a-configuration-file-for-your-powershell-scripts/ # and: http://poshcode.org/1608 # powershell@squidchunks.com # Expects a file ModuleName.config....
PowerShellCorpus/GithubGist/a-oishi_806a873c9a6859ba6ed6_raw_4bf9f741a4f213b77024242e0fee24155ef46f12_gistfile1.ps1
a-oishi_806a873c9a6859ba6ed6_raw_4bf9f741a4f213b77024242e0fee24155ef46f12_gistfile1.ps1
# serial for P9500 $dkc = "" $outfile = "" cd "c:\Program Files\Hewlett-Packard\Performance Advisor\clui" # Get thp pools .\thp.bat -dkc $dkc -L # Get lund pools .\lund.bat -dkc $dkc -dver 015100 -L # Get configs .\exportdb.bat -dkc $dkc -st 02.01.2015 00:00:00 -et 02.01.2015 00:00:10 -dver 020000 -file $outfile...
PowerShellCorpus/GithubGist/zplume_5865633_raw_a529bbe7c3264f171eb83c8c15a69858c32663c5_UpdateUserInfo.ps1
zplume_5865633_raw_a529bbe7c3264f171eb83c8c15a69858c32663c5_UpdateUserInfo.ps1
##### ABOUT ##### # This script updates the mobile number and work number values # for all users in the "User Information List" for all site collections # in the specified web application (see variables below) ##### VARIABLES ##### $webAppURL = "http://mywebapp" $logPath = "C:\temp\UpdateUserInfo\UpdateUserIn...
PowerShellCorpus/GithubGist/jtw_5722025_raw_e42317fa38945f038fb42a36c683d67c900987a3_restoreDB.ps1
jtw_5722025_raw_e42317fa38945f038fb42a36c683d67c900987a3_restoreDB.ps1
# # PowerShell # # Script to determine latest backup file (.bak) for a particular database and restore it. Meant to be used with a scheduled daily job. # # CREATED: 2013-06-06 # MODIFIED: 2013-06-06 @ 11:44AM # AUTHOR: SHATTUCK, JUSTIN $ElapsedTime = [System.Diagnostics.Stopwatch]::StartNew() $productionBa...
PowerShellCorpus/GithubGist/urasandesu_0765055d973d21bd3743_raw_3857e736e3dd42362228885ce1333d7bb02649ca_ConvertTo-MethodIdentity.ps1
urasandesu_0765055d973d21bd3743_raw_3857e736e3dd42362228885ce1333d7bb02649ca_ConvertTo-MethodIdentity.ps1
function TypeToIdentity { param ( [type] $Type ) if ($Type.HasElementType) { $typeIdentity = TypeToIdentity $Type.GetElementType() } else { $typeIdentity = $Type.Name } if ($Type.IsByRef) { $typeIdentity += "Ref" } if ($Type.IsAr...
PowerShellCorpus/GithubGist/omittones_8509005_raw_004fd22a0577ac1aba994df8b5c4e99ae118eba3_ssh-agent-utils.ps1
omittones_8509005_raw_004fd22a0577ac1aba994df8b5c4e99ae118eba3_ssh-agent-utils.ps1
# SSH Agent Functions # Mark Embling (http://www.markembling.info/) # # How to use: # - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice) # - Import into your profile.ps1: # e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes] # - Enjoy...
PowerShellCorpus/GithubGist/glombard_7457530_raw_5adf52f7ed52ac531b1f250ce96cf54e98d523d7_get-jenkins-git-plugins.ps1
glombard_7457530_raw_5adf52f7ed52ac531b1f250ce96cf54e98d523d7_get-jenkins-git-plugins.ps1
$plugins = "${env:ProgramFiles(x86)}\Jenkins\plugins" $c = New-Object Net.WebClient $c.DownloadFile('http://updates.jenkins-ci.org/download/plugins/git-client/1.4.6/git-client.hpi', "$plugins\git-client.hpi") $c.DownloadFile('http://updates.jenkins-ci.org/download/plugins/scm-api/0.2/scm-api.hpi', "$plugins\scm-api....
PowerShellCorpus/GithubGist/awmckinley_5fae30c32e5388fdeb13_raw_39706abc4d9326cffd8bd912cb50abc82d8185ce_boxstarter.ps1
awmckinley_5fae30c32e5388fdeb13_raw_39706abc4d9326cffd8bd912cb50abc82d8185ce_boxstarter.ps1
Disable-UAC Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableShowHiddenFilesFoldersDrives Update-ExecutionPolicy -Policy 'RemoteSigned' cinst 7Zip.Install cinst BTSync cinst Cygwin cinst DaemonToolsLite cinst Foobar2000 cinst Git.Install cinst HG cinst Inconsolata cinst Java.JDK cinst KeePass.Install cinst ...
PowerShellCorpus/GithubGist/nightroman_1272334_raw_3c338e3c692c329f960878ab37aa0266c8ed1508_Measure-Command2.ps1
nightroman_1272334_raw_3c338e3c692c329f960878ab37aa0266c8ed1508_Measure-Command2.ps1
# Measure-Command with several iterations and progress. # Moved to https://github.com/nightroman/PowerShelf
PowerShellCorpus/GithubGist/HostileCoding_bffd6f7e14eef6c6fa0d_raw_2db6a9d0a1f00bbfffb88183cce2559566db3b29_IFTTT_Alarms.ps1
HostileCoding_bffd6f7e14eef6c6fa0d_raw_2db6a9d0a1f00bbfffb88183cce2559566db3b29_IFTTT_Alarms.ps1
#Variable declaration $vCenterIPorFQDN="192.168.243.172" $vCenterUsername="Administrator@vsphere.local" $vCenterPassword="vmware" $OutputFile="C:\Inetpub\wwwroot\mywebsite\feed.xml" #Where you want to place generated report Remove-Item $OutputFile #Delete files from previous runs Write-Host "Connecting t...
PowerShellCorpus/GithubGist/zamber_ac2ff92371496b74a68c_raw_7ee4b6de690f2f231f711f7c270d1d7e00b48fa6_MT-Generate-Worlds.ps1
zamber_ac2ff92371496b74a68c_raw_7ee4b6de690f2f231f711f7c270d1d7e00b48fa6_MT-Generate-Worlds.ps1
# # MTSH (MoreTerra Simple Helper) v0.1.0 # PowerShell 3.0 # # Generate world images from Terraria world with MoreTerra # Configure and fork it as you see fit. # # To schedule it as a task follow this http://j.mp/schedule-powershell # # To host it use http://cestana.com/mongoose.shtml # # Remember to http:/...
PowerShellCorpus/GithubGist/codingoutloud_f3c74eeceb84f2f7ae15_raw_5e325f41632c473bb8fbe3d9b23250c1520c824d_Format-AzureStorageKey.ps1
codingoutloud_f3c74eeceb84f2f7ae15_raw_5e325f41632c473bb8fbe3d9b23250c1520c824d_Format-AzureStorageKey.ps1
Function Format-AzureStorageKey { [CmdletBinding()] Param ( [parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$True)] [string[]] $Primary, [parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$True)] [string[]] $Secondary, [parameter(Mandatory=$True,ValueFromPip...
PowerShellCorpus/GithubGist/VertigoRay_6091281_raw_f28fc4a9ad127ec18f2b6b159c382e0ad53cf89c_InstallFirefox.ps1
VertigoRay_6091281_raw_f28fc4a9ad127ec18f2b6b159c382e0ad53cf89c_InstallFirefox.ps1
Param ( [parameter( Position = 0, Mandatory = $true, HelpMessage = 'This is the version number, such as "22.0". Valid version numbers can be found here: http://mzl.la/1c9hPmo' )] [string] $version, [parameter( Position = 1, Mandatory = $false, H...
PowerShellCorpus/GithubGist/adsmit14_8072908_raw_3522c11956bf2e9946c70ea1d72ef61f5219210c_AddFtpUser.ps1
adsmit14_8072908_raw_3522c11956bf2e9946c70ea1d72ef61f5219210c_AddFtpUser.ps1
<# Name: AddFtpUser.ps1 Author: Adam Smith Date: 12/21/2013 #> ############################################################################### # FTP Server Specific Settings ############################################################################### $ftpUsersRoot = "C:\inetpub\ftproot\" $ftpSiteName = ...
PowerShellCorpus/GithubGist/jpoul_5dfb4abfe7f68a96e4d5_raw_cde4887ccdc8fd8c11791bc98ee4889c2ae513f6_boxstarter.base.ps1
jpoul_5dfb4abfe7f68a96e4d5_raw_cde4887ccdc8fd8c11791bc98ee4889c2ae513f6_boxstarter.base.ps1
Set-ExecutionPolicy -ExecutionPolicy Bypass -Confirm:$false Disable-InternetExplorerESC Enable-RemoteDesktop Set-TaskbarOptions -UnLock #Set-CornerNavigationOptions -EnableUsePowerShellOnWinX # Set-StartScreenOptions -EnableBootToDesktop -EnableListDesktopAppsFirst -EnableDesktopBackgroundOnStart -EnableListDeskto...
PowerShellCorpus/GithubGist/4E71_7453589_raw_acdd8ea9f90e93cb1159af58ecd4aa3f483058e9_LoC.ps1
4E71_7453589_raw_acdd8ea9f90e93cb1159af58ecd4aa3f483058e9_LoC.ps1
# Add/Remove types as needed ls * -recurse -include *.aspx, *.ascx, *.cs, *.ps1, *js | Get-Content | Measure-Object -Line
PowerShellCorpus/GithubGist/yan-shuai_d4e0e8c1651040f0cb3a_raw_2fe6444c211cfd23277712c075f2e71923fbbb65_MyPSSnippets.ps1
yan-shuai_d4e0e8c1651040f0cb3a_raw_2fe6444c211cfd23277712c075f2e71923fbbb65_MyPSSnippets.ps1
# Set a static IP and default gateway Get-NetAdapter -Name Ethernet | New-NetIPAddress -AddressFamily IPv4 -IPAddress 10.0.1.100 -PrefixLength 24 -Type Unicast ` -DefaultGateway 10.0.1.1 # Configure DNS server address Get-NetAdapter -Name Ethernet | Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddre...
PowerShellCorpus/GithubGist/janikvonrotz_8653473_raw_8e385204007f1b57bde43960e1d1ce1725f64b71_Sync-ServiceMailboxAccessGroups.ps1
janikvonrotz_8653473_raw_8e385204007f1b57bde43960e1d1ce1725f64b71_Sync-ServiceMailboxAccessGroups.ps1
<# $Metadata = @{ Title = "Synchronize Service Mailbox Access Groups" Filename = "Sync-ServiceMailboxAccessGroups.ps1" Description = "" Tags = "powershell, activedirectory, exchange, synchronization, access, mailbox, groups, permissions" Project = "" Author = "Janik von Rotz" AuthorContact = "http://jani...
PowerShellCorpus/GithubGist/sheeeng_368fd7ef332bfde409d8_raw_9dedc6d342934f2945152d0ca2319e0e8f817579_gitpull.ps1
sheeeng_368fd7ef332bfde409d8_raw_9dedc6d342934f2945152d0ca2319e0e8f817579_gitpull.ps1
$dirs = Get-ChildItem -Path .\* | ?{ $_.PSIsContainer } $currentDir = Get-Location # dir env:ProgramFiles`(x86`) # dir "env:ProgramFiles(x86)" # ${Env:ProgramFiles(x86)} # [Environment]::GetEnvironmentVariable("ProgramFiles(x86)") # & ${Env:WinDir}\notepad.exe # Invoke-Item ${Env:WinDir}\notepad.exe forea...
PowerShellCorpus/GithubGist/williamjacksn_3708009_raw_58d91f0173a7b8481200ac5943d8243e7e47fb5b_gpo-backup-script.ps1
williamjacksn_3708009_raw_58d91f0173a7b8481200ac5943d8243e7e47fb5b_gpo-backup-script.ps1
Import-Module GroupPolicy Get-GPO -All | Where-Object {$_.DisplayName -like "ops*"} | Backup-GPO -Path "\\server\share" -Comment "Backup Comment"
PowerShellCorpus/GithubGist/grahammcallister_a4752722bba535b9e0b7_raw_b27fb722652b7aee2813b37f2ffb855c3912aa0b_Setup-BuildServer.ps1
grahammcallister_a4752722bba535b9e0b7_raw_b27fb722652b7aee2813b37f2ffb855c3912aa0b_Setup-BuildServer.ps1
try { cinst javaruntime #cinst Gmac.TeamCity Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions Install-WindowsUpdate -AcceptEula Write-ChocolateySuccess 'Setup-BuildServer' } catch { Write-ChocolateyFailure 'Setup-BuildServer' $($_.Exception.Message...
PowerShellCorpus/GithubGist/crancker_5491509_raw_49a1321638b86298f8659b3803892809b0b52d26_sccm_check.ps1
crancker_5491509_raw_49a1321638b86298f8659b3803892809b0b52d26_sccm_check.ps1
$sitecode = "yoursitecode" $server = "your server" Get-WmiObject -Namespace root\sms\Site_$sitecode -query "Select * from SMS_ComponentSummarizer where Status <> 0 AND TallyInterval = '0281128000100008'" -ComputerName $server |select Status,State,Sitecode,Componentname,Errors|format-table -autosize
PowerShellCorpus/GithubGist/alvinsim_9699481_raw_14faefadce36b02003921a80646328ea6c91cbe2_win_autoinstall_chocolatey.ps1
alvinsim_9699481_raw_14faefadce36b02003921a80646328ea6c91cbe2_win_autoinstall_chocolatey.ps1
######################### # Autoinstall script using chocolatey ######################### # Note: Net 4.0 must be installed prior to running this script # #Modify this line to change packages $items = @("ccleaner", "microsoftsecurityessentials", "7zip", "adobereader", "javaruntime", "libreoffice", "googlechrome", "fire...
PowerShellCorpus/GithubGist/AmrEldib_4eaa69ac18f22a30d78b_raw_e1b08242d607211dd97613e4ed0035dc568d449d_GetDate.ps1
AmrEldib_4eaa69ac18f22a30d78b_raw_e1b08242d607211dd97613e4ed0035dc568d449d_GetDate.ps1
Get-Date -format "yyyy-MM-dd HH-mm-ss"
PowerShellCorpus/GithubGist/zahhak_11145046_raw_1e0192cf92b955baa9c63880892f24d1e09f89fe_gistfile1.ps1
zahhak_11145046_raw_1e0192cf92b955baa9c63880892f24d1e09f89fe_gistfile1.ps1
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM # AND install 7-zip, curl and .NET 4 if its missing. # Then use the EC2 tools to create a new AMI from the result, and you have a system # that will execute user-data as a PowerShell script after the instance fires up! # This has b...
PowerShellCorpus/GithubGist/mrxinu_4142396_raw_274b2f37e89c3b94c62d8f6ef0e9e8130953e214_fix-phone.ps1
mrxinu_4142396_raw_274b2f37e89c3b94c62d8f6ef0e9e8130953e214_fix-phone.ps1
# # Script: fix-phone.ps1 # # Purpose: Reformat phone numbers in .txt files from XXX-XXX-XXXX to # (XXX) XXX-XXXX. # # Written by Steven Klassen, sklassen@gmail.com # ############################################################################# # define the pattern $rxPhone = New-Object System.Text...
PowerShellCorpus/GithubGist/daveshah_7789090_raw_1676e7799eeca7fb474e31adebff83966d26ab15_restart.ps1
daveshah_7789090_raw_1676e7799eeca7fb474e31adebff83966d26ab15_restart.ps1
# May require # Set-ExecutionPolicy Remote # if Get-ExecutionPolicy returns "Restricted" Set-Service W3SVC -StartupType Automatic Start-Service W3SVC iisreset
PowerShellCorpus/GithubGist/belotn_6868028_raw_91bbbe1c0a9abe3df7c2313b9685d34c32cc9abd_disabled-unusedgpoparts1L.ps1
belotn_6868028_raw_91bbbe1c0a9abe3df7c2313b9685d34c32cc9abd_disabled-unusedgpoparts1L.ps1
Get-ADOrganizationalUnit -Filter 'OU -like "*Citrix*"' -SearchBase 'dc=fabrikam,dc=com' -Properties * |% { $_.gpLink -split ']' } |? { $_ -match '[0,2]$'} |% {(($_ -replace '\[','').split(';')[0]) -replace 'LDAP://',''} |% { get-adobject $_ -properties * } |sort -Unique DisplayName |% {if( $_.Flags -ne 3 ){if([bool]( g...
PowerShellCorpus/GithubGist/vpag_1092a507f389e99fc669_raw_323e5548781a920f76925c4d9fcdcabe05b17ec3_gistfile1.ps1
vpag_1092a507f389e99fc669_raw_323e5548781a920f76925c4d9fcdcabe05b17ec3_gistfile1.ps1
# get help Get-Help <subj> -Online Get-Help <subj> -ShowWindow # grep -f GetContent -Wait # gc # alias # WMI Get-WmiObject <class> | Get-Member Get-WmiObject <class> | Select-Object * Get-WmiObject -Namespace "root/default" -List (Get-WmiObject -Class Win32_Service -Filter "name='WinRM'").StopService() ...
PowerShellCorpus/GithubGist/rikkit_1c994ef5a8f549216b3d_raw_dd1e2971d4023326fb0aabeea239f0c27cd1ccf3_boxstarter.ps1
rikkit_1c994ef5a8f549216b3d_raw_dd1e2971d4023326fb0aabeea239f0c27cd1ccf3_boxstarter.ps1
##### # START http://boxstarter.org/package/url?https://gist.github.com/rikkit/1c994ef5a8f549216b3d ##### # update windows Install-WindowsUpdate -AcceptEula # windows features cinst Microsoft-Hyper-V-All -source windowsFeatures # system config Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtecte...