full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/GithubGist/fsugiyama_1353200_raw_aefa4add751ab92b16d26ff68d7531915f4c611f_Test-VariableScope.ps1
fsugiyama_1353200_raw_aefa4add751ab92b16d26ff68d7531915f4c611f_Test-VariableScope.ps1
<# .SYNOPSIS 「関連するリンク」先にある「PowerShellのスコープの謎」に迫ってみる。 .DESCRIPTION 「関連するリンク」先にある「PowerShellのスコープの謎」に迫ってみる。 関数内で変数にScriptスコープを指定した場合、指定しなかった場合の影響を確認する。 Windows PowerShellの変数のスコープに関する規則 (1)「参照規則」 変数はそれが作られたスコープ、およびその子孫スコープでのみ参照できる(Privateスコープを除く)。 スコープを指定せずに変数を参照した場合、 変数が見つかるまでカレントスコープから親スコー...
PowerShellCorpus/GithubGist/theagreeablecow_3cdbe888df2586b7109d_raw_e7cd1646f4488183bfdd025b7a8b5660cd279787_Get-PasswordGenerator.ps1
theagreeablecow_3cdbe888df2586b7109d_raw_e7cd1646f4488183bfdd025b7a8b5660cd279787_Get-PasswordGenerator.ps1
<# .NAME Get-PasswordGenerator.ps1 .DESCRIPTION Creates random passwords of varying complexity from ASCII table of characters or phrases from random words selected from on posts on Reddit Ref: http://www.asciitable.com/ & http://www.reddit.com .OPTIONS - Copies password to clipbo...
PowerShellCorpus/GithubGist/michaelkc_aa4d9409cb41dcd79ab7_raw_9be69d90b0d464206801c6437108c260efa52574_EnableRemoteDesktop.ps1
michaelkc_aa4d9409cb41dcd79ab7_raw_9be69d90b0d464206801c6437108c260efa52574_EnableRemoteDesktop.ps1
# wget tinyurl.com/enablerdp -outfile .\rdp.ps1 # .\rdp.ps1 set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0 Enable-NetFirewallRule -DisplayGroup "Remote Desktop" set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStati...
PowerShellCorpus/GithubGist/XPlantefeve_f0671cbad8ffd069dee4_raw_dec024ca54169417294c08d6c02b36cd11709245_Start-ManagementConsole.ps1
XPlantefeve_f0671cbad8ffd069dee4_raw_dec024ca54169417294c08d6c02b36cd11709245_Start-ManagementConsole.ps1
function Start-ManagementConsole { Param( [string]$ComputerName = '.' ) Start-Process -FilePath "${env:windir}\System32\mmc.exe" ` -ArgumentList "compmgmt.msc /computer:\\${ComputerName}" } New-Alias -Name manage -Value "Start-ManagementConsole" -Scope Global
PowerShellCorpus/GithubGist/SamLiu79_8296755_raw_fcb26c16b168e2bf1158400305005f369698c141_restart_vmware_services.ps1
SamLiu79_8296755_raw_fcb26c16b168e2bf1158400305005f369698c141_restart_vmware_services.ps1
#SERVICE_NAME: vspherewebclientsvc #DISPLAY_NAME: VMware vSphere Web Client #SERVICE_NAME: vCOConfiguration #DISPLAY_NAME: VMware vCenter Orchestrator Configuration #SERVICE_NAME: vctomcat #DISPLAY_NAME: VMware VirtualCenter Management Webservices #SERVICE_NAME: vimPBSM #DISPLAY_NAME: VMware vSphere Profile-Driv...
PowerShellCorpus/GithubGist/noahgift_7189835_raw_d78d4a884e28190d146a5378810755cdcc0dbc00_gistfile1.ps1
noahgift_7189835_raw_d78d4a884e28190d146a5378810755cdcc0dbc00_gistfile1.ps1
if ($lastexitcode -ne 0) { throw $errorMessage }
PowerShellCorpus/GithubGist/AndrewBarfield_2552137_raw_8ba014520ad3b3d8ea5efad4375b3ee7bbd51fd8_gistfile1.ps1
AndrewBarfield_2552137_raw_8ba014520ad3b3d8ea5efad4375b3ee7bbd51fd8_gistfile1.ps1
cls # Change the current directory to the System folder cd C:\Windows\System32\ # Display all executable files along with their file description get-childitem * -include *.exe | foreach-object { "{0}, {1}" -f $_.Name, [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileDescription }
PowerShellCorpus/GithubGist/william-gross_9532779_raw_5847e92224a064daeb6168138112d26d625092ac_ewlsync.ps1
william-gross_9532779_raw_5847e92224a064daeb6168138112d26d625092ac_ewlsync.ps1
cd enterprise-web-library git pull https://enduracode.kilnhg.com/Code/Ewl/Group/Canonical.git git push origin
PowerShellCorpus/GithubGist/fengyitsai_6948146_raw_f2307cb5e4d7d7c73c51162e35bfe5a763345b2d_gistfile1.ps1
fengyitsai_6948146_raw_f2307cb5e4d7d7c73c51162e35bfe5a763345b2d_gistfile1.ps1
#!/bin/bash # if else if [ 2 = 1 ] ; then echo "2=1" elif [ 2 = 3 ] ; then echo "2=3" else echo "else" fi # for loop for word in "aaa" "bbb" "ccc" "ddd" do echo $word done # while loop i=0 while [ $i -lt 5 ] ; do echo $i ((i++)) done # until loop i=0 until [ $i -gt 4 ] ; do e...
PowerShellCorpus/GithubGist/kobikun_9735949_raw_565c0b4f73cee915413cdabac1a6a5dbebbb4a30_gistfile1.ps1
kobikun_9735949_raw_565c0b4f73cee915413cdabac1a6a5dbebbb4a30_gistfile1.ps1
$ head eng.examples ! It's his pet theory. "'And next?' I cried, and would have turned on, but the cool hand of the grave woman delayed me. "'I've made a great sacrifice,' I told the whip as I got in. "'Next?' I insisted, and struggled gently with her hand, pulling up her fingers with all my childish strength, and ...
PowerShellCorpus/GithubGist/grenade_9073300_raw_26bf771e836cdcd683deb2925fcd63e5ef0c3bbf_poke.ps1
grenade_9073300_raw_26bf771e836cdcd683deb2925fcd63e5ef0c3bbf_poke.ps1
param ( [hashtable] $pokes, [string] $config ) $xml = (Get-Content $config) -as [xml] foreach($xpath in $($pokes.Keys)){ $xml.SelectSingleNode($xpath).set_InnerXML($pokes[$xpath]) } $xml.Save($config)
PowerShellCorpus/GithubGist/t-mat_ea63944c2f8b7b1d4212_raw_198e75cd4361711c721d33641a1811d18c931871_ftl-resource-unpacker.ps1
t-mat_ea63944c2f8b7b1d4212_raw_198e75cd4361711c721d33641a1811d18c931871_ftl-resource-unpacker.ps1
<# /* powershell .\ftl-resource-unpacker.ps1 'C:\Program Files (x86)\Steam\steamapps\common\FTL Faster Than Light\resources\resource.dat' .\output +0 int32 N:number of files +4 int32 O[0]:offset of file #0 +8 int32 O[1]:offset of file #1 ... +N*4 int32 O[N-1]:offset o...
PowerShellCorpus/GithubGist/jokcofbut_5019836_raw_633279257115ba2119bd1c5e9ffb5b49418348f2_UpdateToSpecificLiveVersionOfAPackage_Solution.ps1
jokcofbut_5019836_raw_633279257115ba2119bd1c5e9ffb5b49418348f2_UpdateToSpecificLiveVersionOfAPackage_Solution.ps1
Update-Package -Id MyPackage -Source "MyRepo" -Version 1.0.12275.1
PowerShellCorpus/GithubGist/DosAmp_5949399_raw_f55a021d3eb0700a107015d7f07629ca6dccca96_gpgwrapper.ps1
DosAmp_5949399_raw_f55a021d3eb0700a107015d7f07629ca6dccca96_gpgwrapper.ps1
$gpgid = "DEADBEEF" # recipient ID (hex/email) # add full path to binaries if needed $gpgcommand = "gpg2" $7zcommand = "7z" foreach ($file in $args) { $source = Get-Item -ErrorAction:SilentlyContinue $file if ($source) { if (-not $source.PSIsContainer) { # file encryption/decryptio...
PowerShellCorpus/GithubGist/thorade_f922e4671d2b67dd55df_raw_9f247986b53de686ab39a7ceb6c53dc839e7f5cd_eps2pdf.ps1
thorade_f922e4671d2b67dd55df_raw_9f247986b53de686ab39a7ceb6c53dc839e7f5cd_eps2pdf.ps1
# This PowerShell script converts all eps files in all subfolders to pdf files $curDir = Split-Path -Parent $MyInvocation.MyCommand.Path $epsFiles = Get-ChildItem -Recurse $curDir\*.eps $texBin = "${env:ProgramFiles(x86)}\MiKTeX 2.9\miktex\bin" Set-Alias eps2pdf $texBin\epstopdf.exe ForEach ($file In $epsFiles...
PowerShellCorpus/GithubGist/espennilsen_8054395_raw_cf6d38c01ecc7ec4ea3e354e0749a420b50fa3e6_netapp_volume_report.ps1
espennilsen_8054395_raw_cf6d38c01ecc7ec4ea3e354e0749a420b50fa3e6_netapp_volume_report.ps1
# ----------------------------------------------------------------------------- # Script: netapp_volume_report.ps1 # Author: @espennilsen # Date: 12/30/2013 # Keywords: volume, report # comments: Creates report of all volumes on a netapp controller # # ---------------------------------------------------------...
PowerShellCorpus/GithubGist/ttkwd_9884556_raw_220c011b5e01c9ec709f4d59350bf04b3cbab14d_gui_test.ps1
ttkwd_9884556_raw_220c011b5e01c9ec709f4d59350bf04b3cbab14d_gui_test.ps1
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") ######################################## # # メイン # ######################################## function main() { try { $form = mainForm [System.Windo...
PowerShellCorpus/GithubGist/t0yv0_554136_raw_2a7088a4723e9f1cb47f4f82d1e154e70de1923f_wget.ps1
t0yv0_554136_raw_2a7088a4723e9f1cb47f4f82d1e154e70de1923f_wget.ps1
# Downloads a file from a given URL to the current directory. function wget($url) { $path = $url.Substring($url.LastIndexOf('/') + 1) $dir = pwd $location = [System.IO.Path]::Combine($dir, $path) $client = new-object System.Net.WebClient $client.DownloadFile($url, $location); } ...
PowerShellCorpus/GithubGist/anderssonjohan_4575105_raw_02dbab6dd0031d19bddbbc175a8f4e04b1cb0343_Install-ARRFromWeb.ps1
anderssonjohan_4575105_raw_02dbab6dd0031d19bddbbc175a8f4e04b1cb0343_Install-ARRFromWeb.ps1
param( [parameter(mandatory=$true, valuefrompipeline=$true)] $TargetHost, [switch] $force ) begin { $packages = @( ` @{ Name = "rewrite.msi"; Url = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi" }, ` @{ Name = "webpi.msi"; Url = "http://download.micr...
PowerShellCorpus/GithubGist/chipitsine_0735bfa08310597f9da8_raw_bf6727a1fce67eb6da1fae29d1e464f1a04962a6_gistfile1.ps1
chipitsine_0735bfa08310597f9da8_raw_bf6727a1fce67eb6da1fae29d1e464f1a04962a6_gistfile1.ps1
#requires -version 4 cls ipmo VirtualMachineManager get-scvirtualmachine | % { [String] $vm = $_.Name ($_.VirtualNetworkAdapters).Where({$_.MACAddressType -eq 'Dynamic'},'First') | % { Write-Host $vm } }
PowerShellCorpus/GithubGist/kouphax_1150025_raw_e50dd2219a77b79d5f8723f1ee323b4f81af82a1_default.ps1
kouphax_1150025_raw_e50dd2219a77b79d5f8723f1ee323b4f81af82a1_default.ps1
# Run the project tests Task Test { }
PowerShellCorpus/GithubGist/thorade_b05f2da5a5d258253af0_raw_83ea8cc92808690e44f0f7fe8af7aa810fafd28c_normalizeEOLF.ps1
thorade_b05f2da5a5d258253af0_raw_83ea8cc92808690e44f0f7fe8af7aa810fafd28c_normalizeEOLF.ps1
# This PowerShell Script will recursively scan all files in the given $scanDir # and normalize the EOF by removing unnecessary whitespace and adding an EOL character to the last line of text # Additionally, the script can normalize every EOL by trimming the trailing white space cls; $scanDir = "BuildingSystems"...
PowerShellCorpus/GithubGist/snobu_0f7dce7726782c02f616_raw_b5b25ce52ca2faf4e17b7c45620d57e5d4ff8298_gistfile1.ps1
snobu_0f7dce7726782c02f616_raw_b5b25ce52ca2faf4e17b7c45620d57e5d4ff8298_gistfile1.ps1
PS> Get-Net6to4Configuration Description : 6to4 Configuration State : Disabled AutoSharing : Default RelayName : 6to4.ipv6.microsoft.com. RelayState : Default ResolutionIntervalSeconds : 1440
PowerShellCorpus/GithubGist/9point6_a622c87ea8e72339c9cd_raw_eeb1e15b72db1a4a9d7088f8c48635a64bc34d78_Microsoft.PowerShell_profile.ps1
9point6_a622c87ea8e72339c9cd_raw_eeb1e15b72db1a4a9d7088f8c48635a64bc34d78_Microsoft.PowerShell_profile.ps1
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { $bckgrnd = "DarkRed" $shellchar = "#" } else { $bckgrnd = "DarkBlue" $shellchar = "$" } $Host.UI.RawUI.BackgroundColor = $bckgrnd $Host.UI.RawUI.Foregr...
PowerShellCorpus/GithubGist/jongalloway_935780_raw_55784163ca3cc72ce036fc4fc61037995b6f5d48_Channel9Downloader.ps1
jongalloway_935780_raw_55784163ca3cc72ce036fc4fc61037995b6f5d48_Channel9Downloader.ps1
# --- settings --- $feedUrl = "http://s.ch9.ms/Events/Build/2014/RSS/" $mediaType = "mp4high" $overwrite = $false $destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "Build14Video" # --- locals --- $webClient = New-Object System.Net.WebClient # --- functions --- function PromptFo...
PowerShellCorpus/GithubGist/absolutejam_5ca7153cf5e639bd1cc3_raw_257186a6043e059539d8d34ec74e3a176f9d32d9_UnlockUserAccount.ps1
absolutejam_5ca7153cf5e639bd1cc3_raw_257186a6043e059539d8d34ec74e3a176f9d32d9_UnlockUserAccount.ps1
# Requirements: # Install RSAT on client and then 'Add / Remove Windows Features', install AD Powershell. # http://www.microsoft.com/en-us/download/details.aspx?id=7887 #-------------------------------------------------------------------------------- # Edit me! $Password = 'Password1' #----------------------------...
PowerShellCorpus/GithubGist/michaellwest_1db258e206beea164e5b_raw_f5300c421523906139163fa268e59ee975a2d36e_Delete%20unused%20media%20items%20older%20than%2030%20days.ps1
michaellwest_1db258e206beea164e5b_raw_f5300c421523906139163fa268e59ee975a2d36e_Delete%20unused%20media%20items%20older%20than%2030%20days.ps1
<# .SYNOPSIS Moves items to the recycle bin which are more than 30 days old and have no references. .NOTES Michael West #> filter Skip-MissingReference { $linkDb = [Sitecore.Globals]::LinkDatabase if($linkDb.GetReferrerCount($_) -eq 0) { $_ } } $date = [...
PowerShellCorpus/GithubGist/gravejester_cb61ed94d2783dae5fe1_raw_9c4be9283a44323302bc78923088217b6a44158a_Get-RDPSession.ps1
gravejester_cb61ed94d2783dae5fe1_raw_9c4be9283a44323302bc78923088217b6a44158a_Get-RDPSession.ps1
# Get-RDPSession.ps1 # Øyvind Kallstad //2012 # Note: borrowed code from http://poshcode.org/3062 #Requires -Version 2 [CmdletBinding()] param( [Parameter(ValueFromPipeline = $true, ValueFromPipelinebyPropertyName = $true)] [string[]]$ComputerName = $env:COMPUTERNAME, [Parameter()] [string]$UserName ) ...
PowerShellCorpus/GithubGist/sandrinodimattia_3645264_raw_7a70ef549115d46f8118b32dab44d12aa44fcf9e_gistfile1.ps1
sandrinodimattia_3645264_raw_7a70ef549115d46f8118b32dab44d12aa44fcf9e_gistfile1.ps1
param([string]$ConnectionString = $(throw "The ConnectionString parameter is required."), [string]$DatabaseName = $(throw "The DatabaseName parameter is required."), [string]$OutputFile = $(throw "The OutputFile parameter is required."), [string]$SqlInstallationFolder = "C:\Program Files (x86)\Mi...
PowerShellCorpus/GithubGist/CombustibleLemon_977f9c39fd777ad42b76_raw_74cfca56daf75ac5b0e1b6790535ef0c7d0ad341_SetupNewComputer.ps1
CombustibleLemon_977f9c39fd777ad42b76_raw_74cfca56daf75ac5b0e1b6790535ef0c7d0ad341_SetupNewComputer.ps1
#ChangeAdminSettings InstallAdminStuff ##### # # ##### ##### ##### # # ##### ##### # # ##### ##### # ## # # # # # # # # # # # # # # # # # ##### # ##### # # ##### # # # ##### ##### # # ## # # # # # # ...
PowerShellCorpus/GithubGist/kunzimariano_11379631_raw_e2311e3025b9c5f309c3fa127c673fa22820a94a_AwsManagementTools.ps1
kunzimariano_11379631_raw_e2311e3025b9c5f309c3fa127c673fa22820a94a_AwsManagementTools.ps1
filter Is-Running { if($_.State.Name -eq 'running') { $_ } } filter IsNot-Running { if($_.State.Name -ne 'running') { $_ } } filter IsNot-Stopped { if($_.State.Name -ne 'stopped') { $_ } } function Stop-AllEC2Instances { (Get-EC2Instance).Instances | IsNot-Stopped | % { Stop-EC2Inst...
PowerShellCorpus/GithubGist/robert-claypool_3d07133474945b87dcd3_raw_96566132320c1e07ddae42e7bd09995d55874682_gpg-message-encryption.ps1
robert-claypool_3d07133474945b87dcd3_raw_96566132320c1e07ddae42e7bd09995d55874682_gpg-message-encryption.ps1
# A Windows command line example for gpg message encryption: # Install Gpg4win to use gpg. # Gpg4win is a email and file encryption package for Windows that includes the open source Gnu Privacy Guard. # It implements the OpenPGP standard and is widely used to sign, verify, encrypt, and decrypt data. # http://www.g...
PowerShellCorpus/GithubGist/Astn_6142bdc3e7bbf7c069db_raw_53e58dfad8e416cca699700933cfdf0583f5ba64_RunRedis64OnWindows-InstallIfMissing.ps1
Astn_6142bdc3e7bbf7c069db_raw_53e58dfad8e416cca699700933cfdf0583f5ba64_RunRedis64OnWindows-InstallIfMissing.ps1
function elevateme { # Get the ID and security principal of the current user account $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent() $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID) # Get the security principal for the Administrator role ...
PowerShellCorpus/GithubGist/ao-zkn_e8cd440c4138ac31dab0_raw_9c826e2dd399fd671f7ebb4a5cd2412354e10b2c_Render-Template.ps1
ao-zkn_e8cd440c4138ac31dab0_raw_9c826e2dd399fd671f7ebb4a5cd2412354e10b2c_Render-Template.ps1
# ------------------------------------------------------------------ # テンプレートファイルと入力データよりファイルを出力する # 関数名:Render-Template # 引数 :TemplateFilePath テンプレートファイルパス # :DataObject データ # :OutPutFilePath 出力ファイルパス # :Encoding 文字コード # 戻り値:なし # ------------------------------------------------------------------ fun...
PowerShellCorpus/GithubGist/sunnyc7_9648755_raw_da47b46aaf62f0bcf820be171cb4e75543a55935_Get-EventedLogin.ps1
sunnyc7_9648755_raw_da47b46aaf62f0bcf820be171cb4e75543a55935_Get-EventedLogin.ps1
Function Get-EventedLogin { param ( [int]$eventid ) #WQL on InstanceCreationEvent $query = "Select * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA 'Win32_NTLogEvent' AND TargetInstance.LogFile='Security' AND TargetInstance.EventCode='$eventid'" #WMI Evented Log Monitor $registerAnEvent ...
PowerShellCorpus/GithubGist/kobusvdm_8ea355e204113a63ce35_raw_27961f696161e5d99f76a2cff3c4b5993bf94c7e_win8host.ps1
kobusvdm_8ea355e204113a63ce35_raw_27961f696161e5d99f76a2cff3c4b5993bf94c7e_win8host.ps1
try { Update-ExecutionPolicy Unrestricted Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar Set-CornerNavigationOptions -EnableUpperRightCornerShowCharms -EnableUpperLeftCornerSwitchApps -EnableUsePowerShellOnWinX S...
PowerShellCorpus/GithubGist/chillitom_8335042_raw_ceaa6550674f1e89ef690721a7b596420ba72cde_rot47.ps1
chillitom_8335042_raw_ceaa6550674f1e89ef690721a7b596420ba72cde_rot47.ps1
function Rot47 { param ([string] $in) $table = @{} for ($i = 0; $i -lt 94; $i++) { $table.Add( "!`"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_``abcdefghijklmnopqrstuvwxyz{|}~"[$i], "PQRSTUVWXYZ[\]^_``abcdefghijklmnopqrstuvwxyz{|}~!`"#$%&'()*+,-./012345678...
PowerShellCorpus/GithubGist/devendrasv_ce0e034657dee7818044_raw_3b9ab79b54276c833c9f1653845508da80919412_addnavigation.ps1
devendrasv_ce0e034657dee7818044_raw_3b9ab79b54276c833c9f1653845508da80919412_addnavigation.ps1
#Credentials to connect to office 365 site collection url $username="spj@Velegandla.onmicrosoft.com" $password="yourpassword" $Password = $password |ConvertTo-SecureString -AsPlainText -force Write-Host "Load CSOM libraries" -foregroundcolor black -backgroundcolor yellow Set-Location $PSScriptRoot Add-Type -Pa...
PowerShellCorpus/GithubGist/RhysC_840533_raw_c48a3f71c232c27fa8cd43b36d544e62aa5d9872_RecursiveFileStringReplace.ps1
RhysC_840533_raw_c48a3f71c232c27fa8cd43b36d544e62aa5d9872_RecursiveFileStringReplace.ps1
Get-ChildItem -exclude *.bak -Recurse -Include *.csproj | Where-Object {$_.Attributes -ne "Directory"} | ForEach-Object { Copy-Item $_ "$($_).bak"; (Get-Content $_) -replace "<HintPath>..\\..\\Lib","<HintPath>..\\..\\..\\Lib" | Set-Content -path $_ }
PowerShellCorpus/GithubGist/alistair_7308746_raw_19ed21ddcc03b1cbe4719a133f7b259dce540acb_deploy.ps1
alistair_7308746_raw_19ed21ddcc03b1cbe4719a133f7b259dce540acb_deploy.ps1
#Modified and simplified version of https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/ $subscription = "[Your Subscription Name]" $service = "[Your Azure Service Name]" $slot = "staging" #staging or production $package = "[ProjectName]\bin\[BuildConfigName]\app.publish\[ProjectName].cspkg"...
PowerShellCorpus/GithubGist/vermorel_47f966ff8bd3fa2d8c76_raw_056de7c48fed95b2915d3ac7ac20d8626a4eeb6f_run-salescast.ps1
vermorel_47f966ff8bd3fa2d8c76_raw_056de7c48fed95b2915d3ac7ac20d8626a4eeb6f_run-salescast.ps1
# ------------------------------------------------- # Function Run-Salescast # By Joannes Vermorel, Lokad, 2015-01 # # Triggers the execution of Salescast project within a Lokad account. # # Syntax: # run-salescast 'myemail' 'mypassword' 'myfolder' # ------------------------------------------------- functi...
PowerShellCorpus/GithubGist/jacobludriks_4bcbcc9cba061f1e09a7_raw_91da708e44fe2326d900303dfa9082022b1b8f3c_xerox-smtp.ps1
jacobludriks_4bcbcc9cba061f1e09a7_raw_91da708e44fe2326d900303dfa9082022b1b8f3c_xerox-smtp.ps1
#Variables needed by script $printerserver = "print server address" $smtpserver = "smtp server address" $emailaddress = "email address to send as" $smtplogin = "email login here" $smtppassword = "email password here" $printerlogin = "printer login here (usually 11111)" $printerpassword = "printer password here (...
PowerShellCorpus/GithubGist/efeamadasun_3837407_raw_57d992360dd1ba3a1467927926b22a143ac757c0_db_mail.ps1
efeamadasun_3837407_raw_57d992360dd1ba3a1467927926b22a143ac757c0_db_mail.ps1
# #.SYNOPSIS #Sends email via SQL Server # #.EXAMPLE #.\db_mail.ps1 -to "efeamadasun@gmail.com; me@efeamadasun.com" -subject "Test email" -body "This is a test" # param( [string]$to, [string]$subject, [string]$body ) $con = New-Object System.Data.SqlClient.SqlConnection $con.ConnectionString = "ser...
PowerShellCorpus/GithubGist/RobertBonham_5910455_raw_7e0ddf3634d5804ba9829a01f69a5880e1d7585d_download.ps1
RobertBonham_5910455_raw_7e0ddf3634d5804ba9829a01f69a5880e1d7585d_download.ps1
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath $rss = (new-object net.webclient) #Set the username for windows auth proxy #$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials #http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/rss/mp4high/?sort=s...
PowerShellCorpus/GithubGist/n3wjack_6fafc16799cb4bb83723_raw_4c44efd1f3b1e36ed207619bb0c83fa864745160_Filter-WebLog.ps1
n3wjack_6fafc16799cb4bb83723_raw_4c44efd1f3b1e36ed207619bb0c83fa864745160_Filter-WebLog.ps1
# # Example usage: Filter-WebLog.ps1 *.log "/foo/bar/" # param ( $FileFilter, $TextFilter ) ls $FileFilter | sls $TextFilter | sls ".js",".png",".gif",".jpg",".css",".less" -NotMatch
PowerShellCorpus/GithubGist/arri-cc_5264818_raw_2786ed9891bbcc53186ed3f30e36b6cf1e6e6004_azureDeployWithSwap.ps1
arri-cc_5264818_raw_2786ed9891bbcc53186ed3f30e36b6cf1e6e6004_azureDeployWithSwap.ps1
Param( $serviceName = "", $storageAccountName = "", $packageLocation = "", $cloudConfigLocation = "", $environment = "Staging", $deploymentLabel = "ContinuousDeploy to $servicename", $timeStampFormat = "g", $alwaysDeleteExistingDeployments = 1, $enableDep...
PowerShellCorpus/GithubGist/srazzaque_6488371_raw_1732b53ab24c01d60148591a75bef5ddc0f1118a_startMongoRs.ps1
srazzaque_6488371_raw_1732b53ab24c01d60148591a75bef5ddc0f1118a_startMongoRs.ps1
# Mongo replica set starter for use in Windows 7 (Powershell 3.x) Write-Host "Mongo Replica Set Starter" Write-Host "WARNING: Will delete rs1/2/3 directories and 1/2/3.log files in the current directory." $replSet = "m101" $curDir = (Get-Location).Path + "\" function Start-MongoRS ($logPath, $dataDir, $portN...
PowerShellCorpus/GithubGist/wullemsb_5468495_raw_bb063072f8da38040a1d0d7cc8b1e4ff146b3946_RemoveSPSite.ps1
wullemsb_5468495_raw_bb063072f8da38040a1d0d7cc8b1e4ff146b3946_RemoveSPSite.ps1
$url= "http://tfssharepoint/sites/defaultcollection/sitetoremove" Remove-SPSite $url -confirm:$false
PowerShellCorpus/GithubGist/Yoos01_a7f75f68947c04af12c0_raw_92b84454de05cace8137f9c7407bacb95e6f629e_gistfile1.ps1
Yoos01_a7f75f68947c04af12c0_raw_92b84454de05cace8137f9c7407bacb95e6f629e_gistfile1.ps1
Clear-Host function create-account () { $hostname = hostname $MyLocalComputer = [adsi] "WinNT://$hostname" $localaccountlogin= "alocalaccount" $localaccountfullname= "Local account fullname" $objlocalaccount = $MyLocalComputer.Create("User", $localaccountlogin) $objlocalaccount.put("FullName", $localaccountfulln...
PowerShellCorpus/GithubGist/ajryan_ba2339a2314a74781898_raw_21535d609c13cb9f08f92efb6b0577e52ebef997_git-new-workdir.ps1
ajryan_ba2339a2314a74781898_raw_21535d609c13cb9f08f92efb6b0577e52ebef997_git-new-workdir.ps1
param ( [string]$NewWorkDir = $( Read-Host 'New work dir' ), [string]$Branch = $( Read-Host 'Branch' ) ) $gitDir = git rev-parse --git-dir if (!$gitDir) { exit 128 } # cannot operate on bare repo $isBare = git --git-dir="$gitDir" config --bool --get core.bare if ($isBare -Eq "true") { echo "'$gitDir' has core...
PowerShellCorpus/GithubGist/dfinke_328a511d03f41bcb88b3_raw_66d07af2e5d2f6829b1adcf6966307d523ccdc16_Get-GithubEvent.ps1
dfinke_328a511d03f41bcb88b3_raw_66d07af2e5d2f6829b1adcf6966307d523ccdc16_Get-GithubEvent.ps1
function Get-GithubEvent { param($userId,$Password) function Get-GitHubAuthHeaders { param($userId,$Password) $authInfo = "$($userId):$($Password)" $authInfo = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($authInfo)) @{ ...
PowerShellCorpus/GithubGist/jonretting_20da31893df25cf40cd7_raw_e951ed0d5120cc3a2e6f2cea47a7a74b067881a1_Get-ADtop.ps1
jonretting_20da31893df25cf40cd7_raw_e951ed0d5120cc3a2e6f2cea47a7a74b067881a1_Get-ADtop.ps1
# Get-ADtop # @ JMR 2012 All right reserved, not for resale # # Retrieves Realtime CPU/MEM/DISK usage details from # AD Computer Objects via provided BaseDN # Or from provided ComputerName # Probes computer names for connectivity before executing # # -SampleTime is the amount of time to sample the CPU usage ...
PowerShellCorpus/GithubGist/uruloki_10684847_raw_5e13438871028e4612762a3e7effbdc043b05c65_Get-ComputerInfo.ps1
uruloki_10684847_raw_5e13438871028e4612762a3e7effbdc043b05c65_Get-ComputerInfo.ps1
<# .Synopsis Enumerates Logged On Sessions on a give host. .DESCRIPTION Enumerates Logged On Sessions on a give host using WMI. .EXAMPLE Get-AuditLogedOnSessions | where {$_.processes.count -gt 0} Retrieves sessions that have running processes. #> function Get-AuditLogedOnSessions { [Cmd...
PowerShellCorpus/GithubGist/smasterson_9141598_raw_a2a50ef8d8596b8fdaee3f06f503aa1ffee038f0_FindScript.ps1
smasterson_9141598_raw_a2a50ef8d8596b8fdaee3f06f503aa1ffee038f0_FindScript.ps1
function Find-Script { param ( [Parameter(Mandatory=$true)] [string]$Keyword ) # Max results returned $Maximum = 20 # Path to scripts directory $StartPath = "E:\scripts" Get-ChildItem -Path $StartPath -Filter *.ps1 -Recurse -ErrorAction SilentlyContinue | Select-String -SimpleMatch -Pattern...
PowerShellCorpus/GithubGist/H2so4_8347495_raw_d06e4115d80eed71e45e2efdec4949fb4e741c7e_Bootstrap-EC2-Windows-CloudInit.ps1
H2so4_8347495_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/bill-long_10596271_raw_87bf501c47e27276c28230c6c9e943ce30189a80_RegexFileSearch.ps1
bill-long_10596271_raw_87bf501c47e27276c28230c6c9e943ce30189a80_RegexFileSearch.ps1
param( [Parameter(Position=0, Mandatory=$true)] [string] $Pattern, [Parameter(Position=1, Mandatory=$false)] [string] $File, [Parameter(Mandatory=$false)] [string] $Directory, [Parameter(Mandatory=$false)] [string] $FileFilter, [Parameter(Mandatory=$false)] [switch] $Recurse = $false ) if ($File.Length -g...
PowerShellCorpus/GithubGist/mortenya_5eda2bdd88eb8b166ae5_raw_c8d42b69974a72452e608148775f05a3594502d2_Backup-SecurityEventLog.ps1
mortenya_5eda2bdd88eb8b166ae5_raw_c8d42b69974a72452e608148775f05a3594502d2_Backup-SecurityEventLog.ps1
# Function to zip the archived log, requires .NET 4.5 function zipFiles($sourceDir, $zipFileName) { Add-Type -Assembly System.IO.Compression.FileSystem $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal [System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, $zipFileName, $comp...
PowerShellCorpus/GithubGist/premsh_5391695_raw_d891c78a36beea8cc92e69c78857df85b3f9fff6_udpateSharePointSolution.ps1
premsh_5391695_raw_d891c78a36beea8cc92e69c78857df85b3f9fff6_udpateSharePointSolution.ps1
$solutionPackageName = "name.wsp" $SolutoinPackagePath = "path\name.wsp" Update-SPSolution -Identity $SolutionPackageName -LiteralPath $SolutionPackagePath -Local -GACDeployment
PowerShellCorpus/GithubGist/GhostTW_647a888e245a1969e33c_raw_8795cd18143e321aaf8b56e60f06e264d1c2c040_win_autoinstall_chocolatey.ps1
GhostTW_647a888e245a1969e33c_raw_8795cd18143e321aaf8b56e60f06e264d1c2c040_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 = @("GoogleChrome", "thunderbird", "skype", "vlc", "quicktime", "flashplayerplugin", "javaruntime", "DotNet4.5", "u...
PowerShellCorpus/GithubGist/guitarrapc_e74d19526d94c6db3577_raw_b8a5b9d3651acece55b43c229b01339406a03e68_continue.ps1
guitarrapc_e74d19526d94c6db3577_raw_b8a5b9d3651acece55b43c229b01339406a03e68_continue.ps1
1..3 | %{ $_ continue $_ } <# 1 #> foreach ($x in (1..3)) { $x continue $x } <# 1 2 3 #>
PowerShellCorpus/GithubGist/obsidience_9946855_raw_71a4cab66c2c9e1617f2b0dba1e9ed2657e7b1f3_Fix-InvalidDates.ps1
obsidience_9946855_raw_71a4cab66c2c9e1617f2b0dba1e9ed2657e7b1f3_Fix-InvalidDates.ps1
$Folder = "\\server\path" $Files = Get-ChildItem -Path $Folder -Recurse $OldestDate = New-Object System.DateTime(1,1,1970) $NewestDate = $(Get-Date).AddDays(1) $CurrentDate = Get-Date foreach($File in $Files) { if($File.CreationTime -lt $OldestDate -or $File.CreationTime -gt $NewestDate) { $File.Creatio...
PowerShellCorpus/GithubGist/jonschoning_5551567_raw_408b5832c845242d81a424508e51c4fc9a091be9_Write-ZipUsing7Zip.ps1
jonschoning_5551567_raw_408b5832c845242d81a424508e51c4fc9a091be9_Write-ZipUsing7Zip.ps1
# Write-ZipUsing7Zip -FilesToZip "C:\SomeFolder" -ZipOutputFilePath "C:\SomeFolder.zip" -Password "password123" # Write-ZipUsing7Zip "C:\Folder\*.txt" "C:\FoldersTxtFiles.zip" -HideWindow function Write-ZipUsing7Zip([string]$FilesToZip, [string]$ZipOutputFilePath, [string]$Password, [switch]$HideWindow) { # L...
PowerShellCorpus/GithubGist/jacobludriks_0f9047a6d3011f13b90f_raw_9607469d2dae993c7de1c97c6e09e58b8ddb3b90_localadministrator.ps1
jacobludriks_0f9047a6d3011f13b90f_raw_9607469d2dae993c7de1c97c6e09e58b8ddb3b90_localadministrator.ps1
#servers ou $serverou = "OU=All Member Servers,DC=domain,DC=com" #all servers $servers = Get-ADComputer -Filter * -SearchBase $serverou $array = @() foreach ($server in $servers) { $Error.Clear() $wmi = Get-WmiObject -ComputerName $server.name -Query "SELECT * FROM Win32_GroupUser WHERE GroupComponent=`"Win32_...
PowerShellCorpus/GithubGist/mattheyan_4598498_raw_d8b16a68f2e235f779fb6a101231ededfaf7cbf5_Get-VisualStudioProjects.ps1
mattheyan_4598498_raw_d8b16a68f2e235f779fb6a101231ededfaf7cbf5_Get-VisualStudioProjects.ps1
$name = "__NAME__" $expr = "ProjectReference Include=`"[^`"]+" + $name + "\.csproj`">" Get-Project -All | ? { (get-content $_.FullName) -match $expr }
PowerShellCorpus/GithubGist/t-mat_8258624_raw_a086b9e6df1a16abb11b4b4b2547210f7743d111_hammerwatch-assets-bin-unpacker.ps1
t-mat_8258624_raw_a086b9e6df1a16abb11b4b4b2547210f7743d111_hammerwatch-assets-bin-unpacker.ps1
<# /* unpack 'C:\Program Files (x86)\Steam\steamapps\common\Hammerwatch\assets.bin' +0 int8[4] 'HWRA' 0x48, 0x57, 0x52, 0x41 +4 int32 number of files +8 file #0 file +0 int8 filename_len +1 int8[filename_len] filename (not NUL(0x00) terminated...
PowerShellCorpus/GithubGist/mubix_b0fee7ba02ba8a225125_raw_a29a2fa819a61309f08bbe812d74dcde0766ae38_powershellpopup.ps1
mubix_b0fee7ba02ba8a225125_raw_a29a2fa819a61309f08bbe812d74dcde0766ae38_powershellpopup.ps1
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName + "\" + [Environment]::UserName,[Environment]::UserDomainName); [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $wc = new-object net.webclient; $wc.Proxy = [System.Net.WebRequest]::DefaultWe...
PowerShellCorpus/GithubGist/cbmeeks_4286686_raw_97400edde3453ad2d278f7aa67c7d6a56f36e5e0_Cleanup-Folders.ps1
cbmeeks_4286686_raw_97400edde3453ad2d278f7aa67c7d6a56f36e5e0_Cleanup-Folders.ps1
function Cleanup-Folders($path) { if($path) { Get-ChildItem -recurse | Where {$_.PSIsContainer -and @(Get-ChildItem -Lit $_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse -whatif } } Cleanup-Folders "c:\temp\blah"
PowerShellCorpus/GithubGist/alienone_6eed416c5ffeb8500764_raw_12ea4f6b09d20d5af606ea0e0da2064d2edb6ee9_legacy.ps1
alienone_6eed416c5ffeb8500764_raw_12ea4f6b09d20d5af606ea0e0da2064d2edb6ee9_legacy.ps1
<# .SYNOPSIS This script is utilized to append JMX remote management parameters to an ArcSight Smart Connector's agent.properties file Function: Append Parameters Author: Justin Jessup Contributions: Bob Fialla - utilize literal Regex, utilize counter $remote_port Email: Justin@alienonesecurity.com Required Depende...
PowerShellCorpus/GithubGist/jstangroome_506252_raw_88eef54b9f661e30cce3d862db2ece9969895fd0_Export-VMTemplate.ps1
jstangroome_506252_raw_88eef54b9f661e30cce3d862db2ece9969895fd0_Export-VMTemplate.ps1
#requires -version 2.0 param ( [parameter(Mandatory=$true)] $VM, [parameter(Mandatory=$true)] [string] $TemplateName, $VMMServer, [parameter(Mandatory=$true)] $LibraryServer, [switch] $PassThru ) $ErrorActionPreference = 'Stop' Set-StrictMode...
PowerShellCorpus/GithubGist/sduplooy_3304441_raw_03c26eeb5bb59b36101dc4b37cfc7bbeea27c379_MassFlash.ps1
sduplooy_3304441_raw_03c26eeb5bb59b36101dc4b37cfc7bbeea27c379_MassFlash.ps1
Write-Host "MassFlash – Version 1.0" Write-Host "Author: SS du Plooy" Write-Host "———————–" If($args.Length -eq 0) { $DirectoryToCopy = "c:DefaultFromCopyLocation" } Else { $DirectoryToCopy = $args[0] } Write-Host "Preparing flash disks with files from" $DirectoryToCopy $drives = Get-WmiObject Win32...
PowerShellCorpus/GithubGist/andrewseward_1322222_raw_b3fbf9dad44f0daf959ccfed1e3d8b0c05876b0c_checkservice.ps1
andrewseward_1322222_raw_b3fbf9dad44f0daf959ccfed1e3d8b0c05876b0c_checkservice.ps1
$service1 = Get-Service -name "My Service Name" -ErrorAction SilentlyContinue if (!$service1) { "service1 is not installed" }
PowerShellCorpus/GithubGist/jstangroome_791112_raw_11fa92cb7d98c8832626ed689264b2498caab42b_Send-RemotingFile.ps1
jstangroome_791112_raw_11fa92cb7d98c8832626ed689264b2498caab42b_Send-RemotingFile.ps1
#requires -version 2.0 [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $ComputerName, [Parameter(Mandatory=$true)] [string] $Path, [Parameter(Mandatory=$true)] [string] $Destination, [int] $TransferChunkSize = 0x10000 ) functio...
PowerShellCorpus/GithubGist/guitarrapc_d89fbd801be78b907924_raw_6878b6973f074096b01e0eea8008c60fa0c5aacb_ConfiguraionMultpleHost.ps1
guitarrapc_d89fbd801be78b907924_raw_6878b6973f074096b01e0eea8008c60fa0c5aacb_ConfiguraionMultpleHost.ps1
Configuration Service { $service = "WinRM", "Winmgmt" $state = "Running" $startupType = "Automatic" Node ("127.0.0.1", "192.168.1.1") { foreach ($x in $service) { Service $x { Name = $x State = $state ...
PowerShellCorpus/GithubGist/rysstad_7c765f840156a68ca30a_raw_bc39a68d97d5b3e75f5e83cfa3605c9bceb53a04_Install-MSIPackage.ps1
rysstad_7c765f840156a68ca30a_raw_bc39a68d97d5b3e75f5e83cfa3605c9bceb53a04_Install-MSIPackage.ps1
$msiPackageToInstall = "<path to .msi>" # save log from installation to temp file $tmpFile = [System.IO.Path]::GetTempFileName() Start-Process msiexec -ArgumentList "/i $msiPackageToInstall /qn /L*v $tmpFile" -NoNewWindow -Wait
PowerShellCorpus/GithubGist/nsabine_6177413_raw_e4352f4357c78a0c40d2303b78e7aa7de2d946a5_create_spanned_drive.ps1
nsabine_6177413_raw_e4352f4357c78a0c40d2303b78e7aa7de2d946a5_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)+[char][int](1...
PowerShellCorpus/GithubGist/beastienopol_652849e96dfa887f498d_raw_41feef4f2369ebf410eb7214b078a17157e24f45_ren_all_files_in_dir.ps1
beastienopol_652849e96dfa887f498d_raw_41feef4f2369ebf410eb7214b078a17157e24f45_ren_all_files_in_dir.ps1
#Rename all files in a directory , setting all characters to lowercase and excluding directories gci -Path D:\temp\ -File -Filter "txt*" | foreach{$_| Rename-Item -NewName $_.Name.ToLower()} -ErrorAction SilentlyContinue #Rename all files in a directory , change only the first letter to lowercase gci -Path D:\t...
PowerShellCorpus/GithubGist/virtualdreams_3949d80ac61590160159_raw_34633b9761e3b18352ad0a76ae520766edb3f02f_git-hash.ps1
virtualdreams_3949d80ac61590160159_raw_34633b9761e3b18352ad0a76ae520766edb3f02f_git-hash.ps1
<# Notes: Author: Thomas Kindler Date: 10.10.2014 Parameters file: path to file git: path to git binary Example: PS C:\ git-hash.ps1 -file "/foo/bar" powershell -file "/path/to/git-hash.ps1" -file "/path/to/file" [-git "/path/to/git"] #> param ( [string]$file, [string]$git = 'C:\Pro...
PowerShellCorpus/GithubGist/goyuix_9773727_raw_fa4ce7929743e01866fe03551d19479040ea847a_AddManagedProperty.ps1
goyuix_9773727_raw_fa4ce7929743e01866fe03551d19479040ea847a_AddManagedProperty.ps1
# Description: script to create a managed property for search that maps to the Active (ows_RoutingEnabled) site column # a few convenience variables $YesNo = [Microsoft.SharePoint.Search.Administration.ManagedDataType]::YesNo $searchApp = Get-SPEnterpriseSearchServiceApplication # get reference to "Active" prop...
PowerShellCorpus/GithubGist/postb99_8319234_raw_f102435d0cd4403e8c022fa05118c2ccd339ddae_apk.ps1
postb99_8319234_raw_f102435d0cd4403e8c022fa05118c2ccd339ddae_apk.ps1
Param( [string]$projectPath=$(throw "projectPath is required (full path to .csproj file)"), [string]$packageName=$(throw "packageName is required"), [string]$configurationDirName=$(throw "configurationDirName is required"), [string]$keyAlias=$(throw "keyAlias is required (keystore key alias)") ) # Paramet...
PowerShellCorpus/GithubGist/jrothmanshore_2656003_raw_c555622680f2f9ebc281c1dc5be5f8d23e23360f_ip_lookup.ps1
jrothmanshore_2656003_raw_c555622680f2f9ebc281c1dc5be5f8d23e23360f_ip_lookup.ps1
$stop = $args.Count $inputIP = "" $inputFile = "" $knownIPFile = "" $showUsage = 0 $verbose = 0 for ($i = 0; $i -lt $stop; $i++) { if ($args[$i] -eq "-f") { if ( ($i + 1) -eq $stop) { $showUsage = 1 } else { $i++ $inputFile = $args[$i] } } elseif ($args[$i] -eq "-k") { if ( ($i +...
PowerShellCorpus/GithubGist/z0c_65ec6f92ebb3687b2633_raw_e115e9e2c659c150bcec7b527ca8c256c55808f4_SslV3-Disable.ps1
z0c_65ec6f92ebb3687b2633_raw_e115e9e2c659c150bcec7b527ca8c256c55808f4_SslV3-Disable.ps1
<# .SYNOPSIS Disables SSL v3 protocol on IIS for POODLE vulnerability .LINK https://www.digicert.com/ssl-support/iis-disabling-ssl-v3.htm #> function Create-SubKey { param( [parameter(position=0)]$path, [parameter(position=1)]$key, [parameter(position=2)]$subKey ) if (!(Test-Path "$path\$...
PowerShellCorpus/GithubGist/ctrlbold_5b913da87049aaa542a2_raw_8bb20234e9f7a79732c53cc2d00a9807b9bc7a7c_Get-LocateLite.ps1
ctrlbold_5b913da87049aaa542a2_raw_8bb20234e9f7a79732c53cc2d00a9807b9bc7a7c_Get-LocateLite.ps1
$GetDll = $true if ($PSScriptRoot) { $location = $PSScriptRoot } else { $location = (Get-Location).Path } $dll = "$location\System.Data.SQLite.dll" if ($GetDll) { $wc = New-Object System.Net.WebClient $url = "https://netnerds.net/System.Data.SQLite.dll" $wc.DownloadFile($url,$dll) } if (!(Test-Path...
PowerShellCorpus/GithubGist/Retro2707_7258159_raw_dc408af6f9767d077295b1ae2e2da4c2dc708766_pow.ps1
Retro2707_7258159_raw_dc408af6f9767d077295b1ae2e2da4c2dc708766_pow.ps1
#1. one way to do it. 2,3,4,10 | ForEach { $_ * 10} #2. other way $numbers = 2,3,4,10 ForEach ($Number in $Numbers) { $Number * 10 | Out-File text.txt -append }
PowerShellCorpus/GithubGist/guitarrapc_0ea326ce89b7fd18be60_raw_1704ecff14cc384e81c27c79603ee82794302c08_RestartWinmgmt.ps1
guitarrapc_0ea326ce89b7fd18be60_raw_1704ecff14cc384e81c27c79603ee82794302c08_RestartWinmgmt.ps1
Restart-Service Winmgmt -Force
PowerShellCorpus/GithubGist/theagreeablecow_2791536_raw_73625d7d323e189814068dd81fbb88b6afed3c22_DepartingUser.ps1
theagreeablecow_2791536_raw_73625d7d323e189814068dd81fbb88b6afed3c22_DepartingUser.ps1
# This script manages the process for a departing user, using data retrived from a CSV file # Requires the Active Directory module for Windows Powershell and appropriate credentials # CSV file with corresponding header and user(s) info: # UserName,DisableWindows,ArchiveFiles,DisableVoice,ArchiveMailbox,MailboxAc...
PowerShellCorpus/GithubGist/ShawInnes_8f2d2f8af69b162245dc_raw_3c79aef4255e2175cc954dff7ea0b4aeef1421df_TestSetup.ps1
ShawInnes_8f2d2f8af69b162245dc_raw_3c79aef4255e2175cc954dff7ea0b4aeef1421df_TestSetup.ps1
# Paste this into Package Manager Console of Visual Studio foreach ($thing in @("NUnit", "NUnit.Extensions", "NUnitTestAdapter", "Shouldly")) { Install-Package $thing }
PowerShellCorpus/GithubGist/vScripter_075fbbb0fc1cf5e9d482_raw_cfd8e2ed13b56d722b8a3ecf07f383babcff6513_Get-VMToolsB2VMapping.ps1
vScripter_075fbbb0fc1cf5e9d482_raw_cfd8e2ed13b56d722b8a3ecf07f383babcff6513_Get-VMToolsB2VMapping.ps1
<# A more complete function can be found in my PowerCLI 'prod' repo at: https://github.com/vMotioned/PowerCLI/blob/master/Get-VMToolsBuildToVersionMapping.ps1 #> Invoke-RestMethod -Method Get -Uri 'http://packages.vmware.com/tools/versions'
PowerShellCorpus/GithubGist/paully21_3486abdd9f9233bccc39_raw_2c1623520bb1271526939e1b673c6b013a7b1cc8_DownloadAllTechEdEurope2014Sessions.ps1
paully21_3486abdd9f9233bccc39_raw_2c1623520bb1271526939e1b673c6b013a7b1cc8_DownloadAllTechEdEurope2014Sessions.ps1
$feedUrl = "http://channel9.msdn.com/Events/TechEd/Europe/2014/RSS/mp4high" [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath $rss = (new-object net.webclient) $a = ([xml]$rss.downloadstring($feedUrl)) $a.rss.channel.item | foreach{ $url = New-Object System.Uri($_.enclosure....
PowerShellCorpus/GithubGist/codingoutloud_7033235_raw_9a53c8d41da789108fd9d687fd325555763c134c_basicauthwithtoken.ps1
codingoutloud_7033235_raw_9a53c8d41da789108fd9d687fd325555763c134c_basicauthwithtoken.ps1
## Example explorers hitting a web endpoint with Basic Auth, when you already have a token in hand $key = "sk_test_mkGsLqEW6SLnZa487HYfJVLf" $url = "https://api.stripe.com/v1/charges" # this will work, but the flow in Basic Auth will first ask you for a password to go with the # value passed in, which serves a...
PowerShellCorpus/GithubGist/annymsMthd_d08ba5e45067e05e45e8_raw_9b5a7d8d2b02bac23cced4fc09f7ee43dfd5e642_Bootstrap-EC2-Windows-CloudInit.ps1
annymsMthd_d08ba5e45067e05e45e8_raw_9b5a7d8d2b02bac23cced4fc09f7ee43dfd5e642_Bootstrap-EC2-Windows-CloudInit.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 been ...
PowerShellCorpus/GithubGist/hail2u_101490_raw_f55a9da07946032adfb56accd3ce4d193c57e454_profile.ps1
hail2u_101490_raw_f55a9da07946032adfb56accd3ce4d193c57e454_profile.ps1
# 現在のユーザー名とホスト名をタイトルに $global:currentuser = [System.Security.Principal.WindowsIdentity]::GetCurrent() $user_and_host = ($currentuser.name -replace "(.*?)\\(.*?)$", "`$2@`$1") $Host.UI.RawUI.WindowTitle = $user_and_host + " - Windows PowerShell" # プロンプトのカスタマイズ function prompt { write-host "" # ディレクトリの表示 (...
PowerShellCorpus/GithubGist/VertigoRay_6091801_raw_c78a24c39108f240ec27aa704f9b94eeedcb6e34_gistfile1.ps1
VertigoRay_6091801_raw_c78a24c39108f240ec27aa704f9b94eeedcb6e34_gistfile1.ps1
[string] $RootOU = 'OU=test,DC=domain,DC=com' [string] $Path = 'OU=foo' try { if (!([adsi]::Exists("LDAP://$Path"))) { Throw("Supplied Path does not exist:`n$Path") } else { Write-Debug "Path Exists (1): $Path" } } catch { # If invalid format, error is thrown. Write-Debug ...
PowerShellCorpus/GithubGist/grantcarthew_6985142_raw_11a7f589e9e6c4b47882d292ad88de69d7f15717_Connect-Telnet.ps1
grantcarthew_6985142_raw_11a7f589e9e6c4b47882d292ad88de69d7f15717_Connect-Telnet.ps1
<# .SYNOPSIS A full graceful telnet client using PowerShell and the .NET Framework. .DESCRIPTION This script was made with a view of using it to have full control over the text stream for automating Cisco router and switch configurations. .PARAMETER TelnetHost The address of the s...
PowerShellCorpus/GithubGist/GuruAnt_9069627_raw_5fd0c6882eced93e57319bc2048d2352bc397dd0_DisplayVMDiskInformation.ps1
GuruAnt_9069627_raw_5fd0c6882eced93e57319bc2048d2352bc397dd0_DisplayVMDiskInformation.ps1
# Create an empty array for results $arrResults = @() # Get the .net view of the virtual machines $objVMViews = Get-View -ViewType "VirtualMachine" | Where-Object {!$_.Config.Template} # Loop through the .net view objects representing the machines ForEach ($objVMView in $objVMViews){ # Loop through the .net...
PowerShellCorpus/GithubGist/actaneon_266652_raw_1f09b634e99e7ddb67069abee6297630cc666e93_profile.ps1
actaneon_266652_raw_1f09b634e99e7ddb67069abee6297630cc666e93_profile.ps1
# My preferred prompt for Powershell. # Displays git branch and stats when inside a git repository. # See http://gist.github.com/180853 for gitutils.ps1. . (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1) function prompt { $path = "" $pathbits = ([string]$pwd).split("\", [System.StringSplitOptions]::Remov...
PowerShellCorpus/GithubGist/glassdfir_5c43acee8cc53a70d7a5_raw_d849a46dc1373159f325fb3b5f7ec6f1d5383307_emlcsv.ps1
glassdfir_5c43acee8cc53a70d7a5_raw_d849a46dc1373159f325fb3b5f7ec6f1d5383307_emlcsv.ps1
$olFolderInbox = 6 $outlook = new-object -com outlook.application; $mapi = $outlook.GetNameSpace("MAPI"); $inbox = $mapi.GetDefaultFolder($olFolderInbox) $inbox.items|Select SenderEmailAddress,to,subject|Export-Csv C:\demoinbox.csv -NoTypeInformation
PowerShellCorpus/GithubGist/peaeater_7709748_raw_7dd51d8549526f2d6132f5a6fc122e08dc0276eb_tif2jpg.ps1
peaeater_7709748_raw_7dd51d8549526f2d6132f5a6fc122e08dc0276eb_tif2jpg.ps1
# convert tifs to jpgs # requires imagemagick Param( [int]$size = 1000, [string]$indir = ".", [string]$outdir = $indir ) if (!(test-path $outdir)) { mkdir $outdir } $files = ls "$indir\*.*" -include *.tif,*.tiff foreach ($file in $files) { $input = ('"{0}"' -f $file.FullName...
PowerShellCorpus/GithubGist/humbleposh_7366411_raw_1ca3ca4f10a4ce03a956673375519cc7f01be553_OfflineFiles_2.ps1
humbleposh_7366411_raw_1ca3ca4f10a4ce03a956673375519cc7f01be553_OfflineFiles_2.ps1
# Connect to the OfflineFilesCache WMI object $offlinefilescache = [wmiclass]"\\localhost\root\cimv2:win32_offlinefilescache" # Force the folder online $offlinefilescache.TransitionOnline("\\server\share") # Force the folder offline $offlinefilescache.TransitionOffline('\\server\share',$true,1) # Pin a fold...
PowerShellCorpus/GithubGist/JM1_65550ad84646d26a290b_raw_b65a5739dfcff079acdec4d3ceb90b7b36796c3d_RecoverKey.ps1
JM1_65550ad84646d26a290b_raw_b65a5739dfcff079acdec4d3ceb90b7b36796c3d_RecoverKey.ps1
# How To Recover Windows 7/8.1 Product Key Without Using Third-Party Tools # By Jakob Bindslet (jakob@bindslet.dk) # Updated on Sep 26th, 2013 # # Usage: # Open Windows PowerShell as administrator # C:\> $oldPolicy = Get-ExecutionPolicy # C:\> Set-ExecutionPolicy RemoteSigned # Click Enter key or 'Y' key ...
PowerShellCorpus/GithubGist/zagnut999_a72ff4b07d6b028f457b_raw_6d08c628292a62e0f115dd785f966b82512387af_RemoveBinObj.ps1
zagnut999_a72ff4b07d6b028f457b_raw_6d08c628292a62e0f115dd785f966b82512387af_RemoveBinObj.ps1
# http://twitter.com/julielerman/status/479641353253818368 Get-ChildItem -include bin,obj -recu -Force | remove-item -force -recurse