full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/GithubGist/clinta_45246140f0ff7a577470_raw_c9b2cf3fdc5524ac0f58143389d8c9972c5d6080_ConvertFrom-RobocopyLog.ps1
clinta_45246140f0ff7a577470_raw_c9b2cf3fdc5524ac0f58143389d8c9972c5d6080_ConvertFrom-RobocopyLog.ps1
<# .Synopsis Parse robocopy log information .DESCRIPTION Parses robocopy logs into a collection of objects summarizing each robocopy operation .EXAMPLE onvertFrom-RobocopyLog C:\robocopy.log .EXAMPLE onvertFrom-RobocopyLog C:\robocopy.log | Export-CSV C:\RobocopySummary.csv #> function ConvertFrom...
PowerShellCorpus/GithubGist/infralabo_7320636_raw_51b781695c4847706fdd21cc581fe6947ed62367_timer.ps1
infralabo_7320636_raw_51b781695c4847706fdd21cc581fe6947ed62367_timer.ps1
Function Get-CountDownTime([int]$seconds){ for ($time=$seconds;$time -ge 0;$time--){ $min = [math]::floor([int]$time/[int]60) $sec = $time % 60 if ($sec -lt 10){ $sec = "0$sec" } [string]"$min`:$sec" Start-Sleep -Seconds 1 Clear-Host } }# Get-CountDownTime 関数の終わり # *** スクリプトのエントリ ポイント ...
PowerShellCorpus/GithubGist/JonasGroeger_9077885_raw_581a416ad4d03c3cef35f3ac5869809733619362_Activate.ps1
JonasGroeger_9077885_raw_581a416ad4d03c3cef35f3ac5869809733619362_Activate.ps1
$workon_home_env__var_name = "WORKON_HOME" $venv_file_name = ".venv" $workon_home = $null # Test if env-var exists if(!(Test-Path Env:\$workon_home_env__var_name)) { $Host.UI.WriteErrorLine("You must set the environment variable '" + $workon_home_env__var_name + "'. It must point to your virtual environmen...
PowerShellCorpus/GithubGist/davehope_6524592_raw_877769ac8724cd6de74cf2d3128bb1a13edc4ae0_Exchange%20-%20Mailbox%20Quotas%20Report.ps1
davehope_6524592_raw_877769ac8724cd6de74cf2d3128bb1a13edc4ae0_Exchange%20-%20Mailbox%20Quotas%20Report.ps1
# # Mailbox Size Reports. # ~~~~~~~~~~~~~~~~~~~~~ # # This script determines the effective mailbox quota and produces a # report for helpdesk staff. # # Changelog # ~~~~~~~~~ # 2012.04.25 Dave Hope Initial version. # 2013.09.11 Dave Hope Updated with new stylesheet and SendMail function. # # ============...
PowerShellCorpus/GithubGist/chrwei_3724873_raw_0ac7a6c13b26ae2a4fe3eb5f3a1269a106dec365_fix-align.ps1
chrwei_3724873_raw_0ac7a6c13b26ae2a4fe3eb5f3a1269a106dec365_fix-align.ps1
if ((Get-PSSnapin "VMware.VimAutomation.Core" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "VMware.VimAutomation.Core" } Connect-VIServer 'vcenter' $vmlist = @() $vmlist += "vncproxy" $vmlist += "vma" $valignervm = "valigner" $valignerip = "10.212.0.17" $method = "align" #check_alignemnt, ...
PowerShellCorpus/GithubGist/jstangroome_1945943_raw_ae9898129bc470a4d66f8a0113e892063d84f6a6_clean-merged-branches.ps1
jstangroome_1945943_raw_ae9898129bc470a4d66f8a0113e892063d84f6a6_clean-merged-branches.ps1
$dontcare = git fetch origin --prune $branches = git branch -a --merged | ?{$_ -match "remotes\/origin"} | ?{$_ -notmatch "\/master"} | %{$_.Replace("remotes/origin/", "").Trim() } if (-not $branches) { echo "No merged branches detected" exit 0 } echo $branches $title = "Delete Me...
PowerShellCorpus/GithubGist/mdnmdn_1493541_raw_dcfd2f87fbec6b5d447bf077a1e1c83a41071f75_uploadfile.ps1
mdnmdn_1493541_raw_dcfd2f87fbec6b5d447bf077a1e1c83a41071f75_uploadfile.ps1
$siteUrl = "http://sharepoint/" $listName = "Site Assets" $fileName = "OfferApp.xap" $filePath = "OfferApp.Web\ClientBin\" + $fileName [system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint") $site = New-Object Microsoft.SharePoint.SPSite($siteUrl) $web = $site.OpenWeb() $list = $web.Lists...
PowerShellCorpus/GithubGist/Blacksly_0490082e5f197aec462f_raw_b8ec30bc8620eeea3207ef47810626b27a2d66f7_gistfile1.ps1
Blacksly_0490082e5f197aec462f_raw_b8ec30bc8620eeea3207ef47810626b27a2d66f7_gistfile1.ps1
127.0.0.1 localhost www.kpi.com
PowerShellCorpus/GithubGist/guitarrapc_9802b36076aee80fa033_raw_82f92a3369365e5bef0b717055d362475cf48e01_MultiPartUpload.ps1
guitarrapc_9802b36076aee80fa033_raw_82f92a3369365e5bef0b717055d362475cf48e01_MultiPartUpload.ps1
# (Get-Item c:\Tools\FileName.zip).Length # Size -> 118073855 # Upload with default -> 10 concurrent connection Write-S3Object -BucketName bucketname -Key FileName.zip -File C:\Tools\FileName.zip
PowerShellCorpus/GithubGist/jonschoning_3432382_raw_27d9911ea9b48d045ff1994115369acfd069d01e_TextReview.ps1
jonschoning_3432382_raw_27d9911ea9b48d045ff1994115369acfd069d01e_TextReview.ps1
# This script extracts all the string literals from a source code tree # so the strings can be examined in a spell checker. # # Author: John D. Cook # http://www.johndcook.com # If path is not provided as an argument, the script searches the current directory. param($srcRoot=(pwd)) # Make an array of file n...
PowerShellCorpus/GithubGist/jeng1111_5606706_raw_f834f855534f6d7ce1184e63aaf3d8bff8c73720_gistfile1.ps1
jeng1111_5606706_raw_f834f855534f6d7ce1184e63aaf3d8bff8c73720_gistfile1.ps1
#thanks to: http://blog.newslacker.net/2012/03/powershell-executing-net-web-request.html # // first argument is mapped to $url #param($url) $url = "https://www.lds.org/general-conference/sessions/2014/04?cid=HPSU040614654&lang=eng" [int]$DownloadCount = 0 #download files to a subfolder in your documents folder ...
PowerShellCorpus/GithubGist/robertchong_3c36357dd8366cae60d5_raw_59643e697d03b2f951854a23b724270b31850f15_LocateExpiredCACerts.ps1
robertchong_3c36357dd8366cae60d5_raw_59643e697d03b2f951854a23b724270b31850f15_LocateExpiredCACerts.ps1
# # LocateExpiredCACerts # Source: http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/17/3386232.aspx # $store=new-object System.Security.Cryptography.X509Certificates.X509Store("\\<COMPUTER_NAME>\CA","LocalMachine") $store.open("ReadOnly") $store.certificates | % { If ($_.NotAfter -lt (Get-Date)) ...
PowerShellCorpus/GithubGist/Gordon-Beeming_e06d0ab7f121bf0121cd_raw_fae08531ef6d355852380aad072e4bd6c1b77647_upgrade-tfs-2013-process-templates.ps1
Gordon-Beeming_e06d0ab7f121bf0121cd_raw_fae08531ef6d355852380aad072e4bd6c1b77647_upgrade-tfs-2013-process-templates.ps1
# Copyright © Microsoft Corporation. All Rights Reserved. # This code released under the terms of the # Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.) # #config $server = "MyTfsServer" $port = 8080 $virtualDirectory = "tfs" $CollectionName = "DefaultCollection" $TeamProjectName...
PowerShellCorpus/GithubGist/jarek-przygodzki_59606741d9668b3eadc1_raw_d4b80da1c2686051ffdb1643d781429bc79f1e99_update-submodules.ps1
jarek-przygodzki_59606741d9668b3eadc1_raw_d4b80da1c2686051ffdb1643d781429bc79f1e99_update-submodules.ps1
$GIT_CMD = '/path/to/git.exe' & $GIT_CMD submodule update --remote $difference = & $GIT_CMD status --porcelain $git_update_count = [regex]::matches($differences, "^M+").count if($git_update_count -ne 0) { & $GIT_CMD commit -m "Aktualizacja wersji submodułów" & $GIT_CMD push origin }
PowerShellCorpus/GithubGist/jirrick_2474503_raw_975f94626c37486e52e330f5d89b2a3fcf691a8c_wifiap.ps1
jirrick_2474503_raw_975f94626c37486e52e330f5d89b2a3fcf691a8c_wifiap.ps1
$wifi = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Wifi_card_identificator_goes_here*"} $miniport = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -eq "Microsoft Virtual WiFi Miniport Adapter"} | Select-Object -first 1 if ( $miniport.MACAddress.Length -lt 17) { W...
PowerShellCorpus/GithubGist/kouphax_1150019_raw_60fc6382fc8ad5f73d8d1655d18257ab16d31af4_default.ps1
kouphax_1150019_raw_60fc6382fc8ad5f73d8d1655d18257ab16d31af4_default.ps1
# Declare default task Task Default -depends Build,Test
PowerShellCorpus/GithubGist/PaulStovell_9522828_raw_7f7163682bc3d87b1b03ccdb78d7512f7b43893e_Octopus.Features.IISWebSite_BeforePostDeploy.ps1
PaulStovell_9522828_raw_7f7163682bc3d87b1b03ccdb78d7512f7b43893e_Octopus.Features.IISWebSite_BeforePostDeploy.ps1
## -------------------------------------------------------------------------------------- ## Configuration ## -------------------------------------------------------------------------------------- $ConfirmPreference = "None" $isEnabled = $OctopusParameters["Octopus.Action.IISWebSite.CreateOrUpdateWebSite"] if ...
PowerShellCorpus/GithubGist/whataride_7638409_raw_29225d8e219b765e7abc29da7e6a3b032da56f36_Operators.ps1
whataride_7638409_raw_29225d8e219b765e7abc29da7e6a3b032da56f36_Operators.ps1
# Arithmatic operators # Comparison operators # -eq, -lt, -gt, -ge, -le, -ne # Logical operators # -not, ! (the same as -not), -and, -or # Conditional operators # -Match (-NotMatch for negative), -Like (-NotLike, -CLike that force case sensitivity) # -Contains, -NotIn $Guy ="Guy Thomas 1949" $Guy -Matc...
PowerShellCorpus/GithubGist/belotn_7751191_raw_dc9e98282df81e02590cf234bfc9455f219abbe5_not_using_farmserverlicence.ps1
belotn_7751191_raw_dc9e98282df81e02590cf234bfc9455f219abbe5_not_using_farmserverlicence.ps1
get-xaserver | get-xaserverconfiguration |? {! $_.LicenseServerUseFarmSettings } | select ServerName
PowerShellCorpus/GithubGist/andy-mcknight_195079110ed51ecfaa63_raw_98cfaed2e55b17db3214b3bcd10b7f939e9eea4e_Check-ShadowCopies.ps1
andy-mcknight_195079110ed51ecfaa63_raw_98cfaed2e55b17db3214b3bcd10b7f939e9eea4e_Check-ShadowCopies.ps1
# This script lists Shadow Copies on specified servers created over past 7 days # # Author: Andy McKnight # Created: 08/12/2014 # Last Edit: 08/12/2014 # $servers = "SERVER1", "SERVER2", "SERVER3" # etc, etc $daystocheck = 7 #region CheckShadowCopies # Uses WMI Win32_Volume to get drive letter from device id Functio...
PowerShellCorpus/GithubGist/fzed51_10022078_raw_5b5fcdb93d367d13310ba76823025efee4f1d41f_Format-ANSI.ps1
fzed51_10022078_raw_5b5fcdb93d367d13310ba76823025efee4f1d41f_Format-ANSI.ps1
<# .Synopsis Formate une sortie console ANSI .DESCRIPTION Cette commande interprête les commande ansi ESC[PL;PcH ESC[PL;Pcf ESC[PnA ESC[PnB ESC[PnC ESC[PnD ESC[s ESC[u ESC[2J ESC[K ESC[Ps;...;Psm .EXAMPLE "←[H←[7mCoucou!!!" | Format-ANSI .EXAMPLE composer...
PowerShellCorpus/GithubGist/PierreMage_6890664_raw_bc2c936c96398afb80d0734f21d2ecf219dc38d2_PowerShell-profile.ps1
PierreMage_6890664_raw_bc2c936c96398afb80d0734f21d2ecf219dc38d2_PowerShell-profile.ps1
# http://technet.microsoft.com/en-us/library/ee692685.aspx # F7 = history # Alt+F7 = history -c # F8 = Ctrl+R Set-Location C: # Easier navigation Set-Alias o start function oo {start .} function .. {Set-Location ..} function ... {Set-Location ..\..} function .... {Set-Location ....
PowerShellCorpus/GithubGist/TearTheSky_f5d39df867b278eb5555_raw_4dc7e7b3c5235630118e398e8bcf1af7438d535c_Get-MultiCellValues.ps1
TearTheSky_f5d39df867b278eb5555_raw_4dc7e7b3c5235630118e398e8bcf1af7438d535c_Get-MultiCellValues.ps1
#引数定義 Param ( [string]$pathName = "", [int]$targetSheetNumber = -1, [string]$targetCollumn = "", [int]$targetRow = -1 ) #****************************************************************************** # 機能 : Excel起動 # # 機能説明 : Excelを起動する。 # # 引数 : なし # # 戻り値 : Exce...
PowerShellCorpus/GithubGist/grantcarthew_7002208_raw_0bae4e8cea578315c84de52cf02104a2e2cbf07f_Initialize-SPWeb.ps1
grantcarthew_7002208_raw_0bae4e8cea578315c84de52cf02104a2e2cbf07f_Initialize-SPWeb.ps1
<# .Synopsis Invokes a standard web request against all the sites in SharePoint. .Description There are some dependencies to run this script as follows; The account used to run this script will need read access to all sites for the initialization to fully succeed. This script is required to ...
PowerShellCorpus/GithubGist/threecourse_7852959_raw_f894a4d5e06660e7ba3d264bdaa3e2a90ee59d45_CSharpCompileRun.ps1
threecourse_7852959_raw_f894a4d5e06660e7ba3d264bdaa3e2a90ee59d45_CSharpCompileRun.ps1
# --------------------------------------------------------------------- # PowershellからC#コードをコンパイル・実行するサンプル # # (参考) # http://codezine.jp/article/detail/5007 # # (注意点) # .NET Frameworkの制約上、Add-Typeによる型の追加を再実行するには、Powershellのセッションを切る必要がある。 # そのため、Powershellのプロセスを立ち上げ、その中でコンパイル・実行するようにしている。 # ------------------...
PowerShellCorpus/GithubGist/yun2dot0_47f02634b06c28b03238_raw_b2152a7646ad083fa6bc048c641768c142dc6f2f_profile.ps1
yun2dot0_47f02634b06c28b03238_raw_b2152a7646ad083fa6bc048c641768c142dc6f2f_profile.ps1
# UTF-16で保存すること # タイトルバーを見た目よくする $(Get-Host).UI.RawUI.WindowTitle = ` ([Security.Principal.WindowsIdentity]::GetCurrent().name -replace "^(.*?)\\(.*?)$", "`$2@`$1")` + " - Windows PowerShell"` + $(if((([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` ...
PowerShellCorpus/GithubGist/nakaji_3445423_raw_91c03e318ad4093c5f68bb8d14c56630da76cac0_gistfile1.ps1
nakaji_3445423_raw_91c03e318ad4093c5f68bb8d14c56630da76cac0_gistfile1.ps1
# 指定されたディレクトリ配下のファイルに対して、MD5チェックサムを取得する # # 下記ブログを参考に作成 # PowerShell でハッシュ値を計算する(http://blogs.gine.jp/taka/archives/1369) param($path) function GetMD5{ param($fileName) $stream = New-Object IO.StreamReader $fileName # MD5ハッシュ値を計算する $md5 = [System.Security.Cryptography.MD5]::Create(...
PowerShellCorpus/GithubGist/dfinke_3923295_raw_9d9f05c1790d6e1581483e3c2a5f4750edb95b14_InvokeCompileAllTS.ps1
dfinke_3923295_raw_9d9f05c1790d6e1581483e3c2a5f4750edb95b14_InvokeCompileAllTS.ps1
function Invoke-CompileAllTS { <# .Synopsis Recursively searches for TypeScript files and invokes the compiler on the target .Example Invoke-CompileAllTS #> ls . -Recurse *.ts | ForEach {tsc $_.fullname} }
PowerShellCorpus/GithubGist/rpunt_5134907_raw_4316fee30d222cb2b708c66616a954dd1232e8ef_Verify%20User%20Credentials.ps1
rpunt_5134907_raw_4316fee30d222cb2b708c66616a954dd1232e8ef_Verify%20User%20Credentials.ps1
[CmdletBinding()] param ( [parameter(Mandatory=$true)][string]$adminuser, [parameter(Mandatory=$true)][string]$adminpassword ) $computer = gc env:computername # did you enter valid credentials for a local user? [Reflection.Assembly]::LoadFile('C:\Windows\assembly\GAC_MSIL\System.DirectoryServices...
PowerShellCorpus/GithubGist/vinadm_0fd14cd7b748ae1a23ad_raw_b9cfa71e9821d85fe3752ea5808e4bec915aea88_gistfile1.ps1
vinadm_0fd14cd7b748ae1a23ad_raw_b9cfa71e9821d85fe3752ea5808e4bec915aea88_gistfile1.ps1
# Uses Quest Active Roles # Free to download http://www.quest.com/powershell/activeroles-server.aspx # # Special Thanks to Mladen Milunovic for his comments that improved the Script! # # List all computers that have been # Inactive in "Active Directory"(Boy THERE'S a play on words!) # for a specified Numb...
PowerShellCorpus/GithubGist/breezhang_6610058_raw_cdeea142168ea13583fc34dc0812e0783dd5f2d4_a.ps1
breezhang_6610058_raw_cdeea142168ea13583fc34dc0812e0783dd5f2d4_a.ps1
function Get-IniContent ($filePath) { $ini = @{} switch -regex -file $FilePath { "^\[(.+)\]" # Section { $section = $matches[1] $ini[$section] = @{} $CommentCount = 0 } "^(;.*)$" # Comment { # $value = $match...
PowerShellCorpus/GithubGist/pbabcock_6034350_raw_3b516d2639682aceb6880641a51a0f190e0c33ae_envdemo.ps1
pbabcock_6034350_raw_3b516d2639682aceb6880641a51a0f190e0c33ae_envdemo.ps1
$tempPath = $(get-location) Write-Output "Current directory: $($tempPath)" [Environment]::SetEnvironmentVariable("DevPath", "$($tempPath)\Dev", "User") Write-Output "Value of DevPath $($tempPath)\Dev"
PowerShellCorpus/GithubGist/hsiboy_bfed1d445e936c4773fa_raw_bee66eef37b1b3471a908d402c175f69a73ec69c_install.ps1
hsiboy_bfed1d445e936c4773fa_raw_bee66eef37b1b3471a908d402c175f69a73ec69c_install.ps1
#set up vars $computername = Get-Content 'server_list.txt' $msiname = "NewRelicAgent_x86_3.4.24.0.msi" $licenseKey = "aaaaabbbbbbcccccdddddeeeeeffffggggghhhhh" $destinationFolder = "\\$computer\C$\temp\install" $payload = $destinationFolder + "\" + $msiname foreach ($computer in $computername) { #This ...
PowerShellCorpus/GithubGist/sunnyc7_9579625_raw_aa58dae2428d4c479053a4e45f0d23c1c120c990_get-continiouscounterpoll.ps1
sunnyc7_9579625_raw_aa58dae2428d4c479053a4e45f0d23c1c120c990_get-continiouscounterpoll.ps1
# Author: Sunny Chakraborty. 2014 (@sunnyc7) # BasedOn: Matt Graeber's beautiful work with Powershell Lambda functions. # Powershell Magazine Source: http://www.powershellmagazine.com/2013/12/23/simplifying-data-manipulation-in-powershell-with-lambda-functions/ # Code: get-continiouscounterpoll.ps1 # Source: htt...
PowerShellCorpus/GithubGist/ringe_7579356_raw_5b088396be9fae814534929e13e95061b815a959_logoff_sessions.ps1
ringe_7579356_raw_5b088396be9fae814534929e13e95061b815a959_logoff_sessions.ps1
$timeout = 300 $message = "Please save your work. You will be logged off in "+ $timeout/60 +" minutes" $sessions = @() # Collect session IDs and warn users query session | select-string "wdica" | %{$_ -replace " {2,27}"," "} | foreach {$_.ToString().split(" ")[3]} | foreach { $sessions += $_ msg $_ /TIME:...
PowerShellCorpus/GithubGist/rdrobinson3_5707787_raw_90a37fe63a1c6bb43b782eaa7d69f220b47ded50_AddSiteColumnsToContentTypes.ps1
rdrobinson3_5707787_raw_90a37fe63a1c6bb43b782eaa7d69f220b47ded50_AddSiteColumnsToContentTypes.ps1
# # Description: # # This script adds Site Columns to the appropriate Content Types as listed in # the AddSiteColumnsToContentTypes.csv. The .CSV needs to be saved to # "C:\PowerShell\" directory. If this directory does not exist, you will need to create it. # # Running this script requires running PowerShell...
PowerShellCorpus/GithubGist/GuruAnt_7197673_raw_1623cf9eeb7b8dc6323ea71884509b52fa0d43c4_Get-AppSenseLogonTimes.ps1
GuruAnt_7197673_raw_1623cf9eeb7b8dc6323ea71884509b52fa0d43c4_Get-AppSenseLogonTimes.ps1
Function Get-AppSenseLogonTimes { <# .Synopsis Returns information about AppSense logon events as recorded by the AppSense event log .Description Returns, via the AppSense Event log, the Logon Time, Node Name, Action, Start Time and Duration of AppSense logon actions. Useful for tuning and optimising Ap...
PowerShellCorpus/GithubGist/mnzk_c317848463ce0f2e391e_raw_3594a2ac881e449d76b5e2e55ec064a938c1f658_primes.ps1
mnzk_c317848463ce0f2e391e_raw_3594a2ac881e449d76b5e2e55ec064a938c1f658_primes.ps1
# # 既知の素数リストを保存しているファイルを読み込み # 続きから素数を列挙する # # 素数リストファイルは # primes000.txt, primes001.txt, primes002.txt ... # と複数ファイルに分割されていても良い。 # ファイル番号の順に内容を連結した時、素数が昇順に並んでいること。 # 新たな素数は、ファイル番号最大+1のファイル名で保存します。 # # ファイルが1つもない場合、初めにprimes000.txt を生成します。 # # [実行例] # 下記スクリプトを読みこんだ後、 # # > enumerate-prime-numbers 1000...
PowerShellCorpus/GithubGist/agileguy_1476823_raw_43e0d9304d76865cbfeafae0acd3806656199375_sudo.ps1
agileguy_1476823_raw_43e0d9304d76865cbfeafae0acd3806656199375_sudo.ps1
$file, [string]$arguments = $args; if([System.IO.File]::Exists("$(get-location)\$file")) { $file = "$(Get-Location)\$file"; } $psi = new-object System.Diagnostics.ProcessStartInfo $file; $psi.Arguments = $arguments; $psi.Verb = "runas"; [System.Diagnostics.Process]::Start($psi);
PowerShellCorpus/GithubGist/patrickmslatteryvt_11196973_raw_8f2c0be3cb6615381ab4427e82a00ec1c8172105_create_zol_vm.ps1
patrickmslatteryvt_11196973_raw_8f2c0be3cb6615381ab4427e82a00ec1c8172105_create_zol_vm.ps1
# Stops the client whining about certs Set-PowerCLIConfiguration -InvalidCertificateAction ignore # Edit these values to suit your environment Connect-VIServer -server vcenter.dev.acme.com -User root -Password ******************* # VM host we will create the VM on $VS5_Host = "10.10.10.2" # Name of VM we want...
PowerShellCorpus/GithubGist/mkropat_85ac76202a72839d955f_raw_1e0244a89dccf43a65368e6e14c0b3ad12bbc221_set-ie-proxy.ps1
mkropat_85ac76202a72839d955f_raw_1e0244a89dccf43a65368e6e14c0b3ad12bbc221_set-ie-proxy.ps1
$setProxy = { param($proxy) Set-Location 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' Set-ItemProperty . ProxyServer $proxy Set-ItemProperty . ProxyOverride '<local>' Set-ItemProperty . ProxyEnable 1 } # You can run $setProxy as another user like so: # # Start-Job -...
PowerShellCorpus/GithubGist/jakeballard_9019658_raw_375bbfe9e572402826e5fe6ffef92d2528069c11_Get-PrintSpoolerCrashes.ps1
jakeballard_9019658_raw_375bbfe9e572402826e5fe6ffef92d2528069c11_Get-PrintSpoolerCrashes.ps1
param( $ComputerList = ("$env:COMPUTERNAME"), $Cred = $(Get-Credential "$env:USERDOMAIN\$env:USERNAME") ) $Result1 = Invoke-Command -ComputerName $ComputerList -Credential $Cred -ScriptBlock { $Win32_OperatingSystem = Get-WmiObject -Class 'Win32_OperatingSystem' $LastBootUpTime = $Win32_Operat...
PowerShellCorpus/GithubGist/Mierdin_11362400_raw_941433296b024d4d5f56c2f361134cb0bf1c10e4_StorageTrueUp.ps1
Mierdin_11362400_raw_941433296b024d4d5f56c2f361134cb0bf1c10e4_StorageTrueUp.ps1
<# Name: StorageTrueUp.ps1 Author: Matthew Oswalt Created: 4/27/2014 Description: Storage True-Up Currently only tested and verified with the following platforms: Hardware Platforms: *NetApp Release 8.2P2 Cluster-Mode ...
PowerShellCorpus/GithubGist/rjattrill_3057564_raw_060dd107a2616d5c70cc3c38210fe7cc487649b7_TestPort.ps1
rjattrill_3057564_raw_060dd107a2616d5c70cc3c38210fe7cc487649b7_TestPort.ps1
1443 | % { echo ((new-object Net.Sockets.TcpClient).Connect("192.168.75.11",$_)) "server listening on TCP port $ _" }
PowerShellCorpus/GithubGist/thlorenz_525571_raw_e35b39187593ce2f7d4f23cc4fd117e9b1be837e_git_svn_ps_prompt.ps1
thlorenz_525571_raw_e35b39187593ce2f7d4f23cc4fd117e9b1be837e_git_svn_ps_prompt.ps1
# See http://gist.github.com/180853 for gitutils.ps1. . (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1) function prompt { writeUserLocation if (isCurrentDirectoryGitRepository) { writeGitInfo } elseif(Test-Path .svn) { writeSvnInfo } Write-Host("`n$") -nonewline -fo...
PowerShellCorpus/GithubGist/mrdrbob_4111019_raw_2cae2e025b170cde39480e2216e052d075191530_Script-Database.ps1
mrdrbob_4111019_raw_2cae2e025b170cde39480e2216e052d075191530_Script-Database.ps1
function global:Script-Database([string]$server, [string]$dbname, [string]$filename) { add-type -AssemblyName "Microsoft.SqlServer.ConnectionInfo, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" | out-null add-type -AssemblyName "Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=neutral, Public...
PowerShellCorpus/GithubGist/MichaelPaulukonis_72a03ad6bc3df5492490_raw_873ea153d55cf93e1c7fc9aaedb7280e30ce3899_copy.setup.ps1
MichaelPaulukonis_72a03ad6bc3df5492490_raw_873ea153d55cf93e1c7fc9aaedb7280e30ce3899_copy.setup.ps1
$sourceDir = "\\path\to\source\" $destDir = "\\path\to\dest\" # NOTE: this WILL overwrite existing docs (unless open) Copy-Item $sourceDir*.docx $destDir # delete (hidden, leftover) office temp files # usually caused by killing processes Remove-Item ~*.docx -force
PowerShellCorpus/GithubGist/aggieben_3643522_raw_34a05e3668642b1a3765b75bbc009c50d83e245d_TestEmail.ps1
aggieben_3643522_raw_34a05e3668642b1a3765b75bbc009c50d83e245d_TestEmail.ps1
$mail = New-Object System.Net.Mail.SmtpClient("smtp.geusnet.com", 25) $mail.Send("aggieben@gmail.com", "bcollins@praecoemailtest.cloudap...", "testing kato", "blah")
PowerShellCorpus/GithubGist/sumhat_d2a6d491e0df5943cead_raw_85326b673ec950d1063fbdc69e4d863cd7288263_gistfile1.ps1
sumhat_d2a6d491e0df5943cead_raw_85326b673ec950d1063fbdc69e4d863cd7288263_gistfile1.ps1
Function Get-Data { Param ( [int] $data = -1 ) return $data; }
PowerShellCorpus/GithubGist/andreaswasita_bb862f9fbcfa9c305236_raw_fa46c303d5ba6a6cdfb07c24cba446b3589951e8_New-AzureVMStaticDIP.ps1
andreaswasita_bb862f9fbcfa9c305236_raw_fa46c303d5ba6a6cdfb07c24cba446b3589951e8_New-AzureVMStaticDIP.ps1
cls Import-module Azure $subscription = Read-Host -Prompt 'Microsoft Azure Subscription:' $storage = Read-Host -Prompt 'Storage Account Name:' Set-azuresubscription -SubscriptionName $subscription -CurrentStorageAccountName $storage #Get the latest Windows Server 2012 Datacenter image $images = Get-AzureVMImage ` |...
PowerShellCorpus/GithubGist/rdingwall_2953197_raw_773fba3ef6f628e512a699301da6e003e21ba7c4_StripAuthorXMLComments.ps1
rdingwall_2953197_raw_773fba3ef6f628e512a699301da6e003e21ba7c4_StripAuthorXMLComments.ps1
# Powershell to recursively strip all <author> XML comments out of *.cs files. # See 'collective code ownership' for why we do not want to encourage individual # developers claiming/marking sections of code # http://jamesshore.com/Agile-Book/collective_code_ownership.html. # # (And if for some reason you really ...
PowerShellCorpus/GithubGist/wictorwilen_d3c082852a81b051ca07_raw_7317262d24ab2849a741fb53f0fd34cbb4fc667f_gistfile1.ps1
wictorwilen_d3c082852a81b051ca07_raw_7317262d24ab2849a741fb53f0fd34cbb4fc667f_gistfile1.ps1
# Copy the current entry to a new (called No Hyper-V) bcdedit /copy {current} /d "No Hyper-V" # Note the Id from the command result above bcdedit /set <ID> hypervisorlaunchtype off # Set the default one to the newly created entry bcdedit /default /ID <ID>
PowerShellCorpus/GithubGist/GuruAnt_7559974_raw_5b736d21aed2fdee3860d5b0d5b1f7524f625189_Invoke-SubversionScript.ps1
GuruAnt_7559974_raw_5b736d21aed2fdee3860d5b0d5b1f7524f625189_Invoke-SubversionScript.ps1
Function Invoke-SubversionScript { <# .Synopsis Runs a script directly from Subversion. .Description Given a valid Subversion URL and credentials (Basic authentication) invokes the script on the local machine. .Parameter Url The URL of the script. Should be a valid URL, an...
PowerShellCorpus/GithubGist/xinmyname_917733_raw_431c62252610c65332b4b73ed75bc51264fb9c8f_set-svnignore.ps1
xinmyname_917733_raw_431c62252610c65332b4b73ed75bc51264fb9c8f_set-svnignore.ps1
svn -R --depth immediates propset svn:ignore -F <path-to-svn-ignore-txt> <path-to-svn-repository>
PowerShellCorpus/GithubGist/Sakuramochi_5227075_raw_96ed0b55c496c1c9b76c1d534eed860ac92f2f1b_webclient_downloaddata.ps1
Sakuramochi_5227075_raw_96ed0b55c496c1c9b76c1d534eed860ac92f2f1b_webclient_downloaddata.ps1
# Yahoo Japanへお遣いにいってトピックスをもぎってくるスクリプト # 言語 # Windows Powershell # 書式 # test_webclient # オプション # なし $access_url = "http://www.yahoo.co.jp" # ここからwebclient方式 $client = New-Object System.Net.WebClient $enc = [Text.Encoding]::GetEncoding("utf-8") $html_data = $enc.GetString( $client.DownloadData( ...
PowerShellCorpus/GithubGist/objectx_5781757_raw_0b3cbd584aa770dfb41187b7806c966f71850436_indynize.ps1
objectx_5781757_raw_0b3cbd584aa770dfb41187b7806c966f71850436_indynize.ps1
# # indynize.ps1: InvokeDynamic enabler for Groovy on windows. # # AUTHOR(S): Masashi Fujita <objectxtreme@gmail.com> # param ([switch]$WhatIf = $false, [switch]$Verbose = $false) $groovydir = Split-Path -parent $MyInvocation.MyCommand.Path | Split-Path -parent $libdir = Join-Path $groovydir "lib" $orig...
PowerShellCorpus/GithubGist/stknohg_5d8f6c4c250a5545c696_raw_4d19632bee9591679230ec0a88c8c1954f925f8f_pronama_calendar.ps1
stknohg_5d8f6c4c250a5545c696_raw_4d19632bee9591679230ec0a88c8c1954f925f8f_pronama_calendar.ps1
# # プロ生ちゃん #カレンダープログラミング プチコンテスト用カレンダーPowerShell版 # 日曜始まりの当月のカレンダーを表示します。 # 土曜日は青色、日曜日は赤色で表示されます。 # $Today = (Get-Date).Date; $Year = $Today.Year; $Month = $Today.Month; $CharWidth = 2; $SpaceWidth = 1; $DefaultColor= 'White'; Write-Host ( "{0:yyyy/MM}" -F $Today).PadLeft(($CharWidth * 7 + $SpaceWidth * 6) / 2 +...
PowerShellCorpus/GithubGist/wiking-at_47da5610e895e8b51aae_raw_516c8d1f935d4ed448fceda877203261b35be5de_migrate-inidb-to-extdb.ps1
wiking-at_47da5610e895e8b51aae_raw_516c8d1f935d4ed448fceda877203261b35be5de_migrate-inidb-to-extdb.ps1
$VerbosePreference = "SilentlyContinue" $ErrorActionPreference= 'silentlycontinue' Function Get-IniContent { <# .Synopsis Gets the content of an INI file .Description Gets the content of an INI file and returns it as a hashtable .Notes Au...
PowerShellCorpus/GithubGist/nskerl_8985365_raw_844828bb13f5c2946a2a33a8cc14e568cb3ddf0b_Deploy.ps1
nskerl_8985365_raw_844828bb13f5c2946a2a33a8cc14e568cb3ddf0b_Deploy.ps1
# the service params (Octo can/should pass these in) $serviceName = "MyCompany.MyService" $serviceExe = "MyService.exe" $fullPath = Join-Path -Path $OctopusPackageDirectoryPath -ChildPath $serviceExe # resolve service context $service = Get-Service MyCompany.MyService -ErrorAction SilentlyContinue if (! $s...
PowerShellCorpus/GithubGist/z0c_9780385_raw_9a274d024ecb45f6530497ce04d069c8dead669b_Psake-Build.ps1
z0c_9780385_raw_9a274d024ecb45f6530497ce04d069c8dead669b_Psake-Build.ps1
Properties { $baseDir = Resolve-Path . $project = Split-Path $baseDir -Leaf $artifactDir = "$baseDir\Build\Packages" $version = "1.0.1" } Task Default -Depends Build Task Clean { if (Test-Path "$baseDir\build") { Remove-Item "$baseDir\Build" -Recurse -Force -ErrorAction Stop } } Task RestorePackag...
PowerShellCorpus/GithubGist/ecki_6725537_raw_e46d1eea3ea0d97799c3a24061eee5aa3be42e24_openantrag-j2c.ps1
ecki_6725537_raw_e46d1eea3ea0d97799c3a24061eee5aa3be42e24_openantrag-j2c.ps1
# # This will format http://openantrag.de/api/proposal/ID/gettop/100 JSON files into CSV # $list = @() foreach($file in Get-ChildItem -Filter proposal-*.json .) { $list += ((Get-Content -Encoding UTF8 $file) -join "`n" | ConvertFrom-Json) } # Inspect Result graphically: PS1> $list | Out-GridView # Inspec...
PowerShellCorpus/GithubGist/g-un--_4111309_raw_74b391943ee52db760f95108672d173c16101227_GroupRegexReplace.ps1
g-un--_4111309_raw_74b391943ee52db760f95108672d173c16101227_GroupRegexReplace.ps1
"Test 1.1.1.1" -replace "(?<first>\d+\.\d+\.\d+\.)\d+", '${1}2'
PowerShellCorpus/GithubGist/sunnyone_5610762_raw_97f8a2ea5ac432a642dd42c0421ea6244af1d972_screenshot.ps1
sunnyone_5610762_raw_97f8a2ea5ac432a642dd42c0421ea6244af1d972_screenshot.ps1
[Reflection.Assembly]::LoadWithPartialName("System.Drawing") function Get-ScreenShot($Path, [Drawing.Rectangle]$Bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds) { $bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height $graphics = [Drawing.Graphics]::FromImage($bmp) $graphics.CopyFr...
PowerShellCorpus/GithubGist/vgrem_9763560fc9a5fd273ea0_raw_055bfc3521daa623e3a928c0e993b7ef0ec70577_Print-SPOSites.ps1
vgrem_9763560fc9a5fd273ea0_raw_055bfc3521daa623e3a928c0e993b7ef0ec70577_Print-SPOSites.ps1
Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" $AdminUrl = "https://tenant-admin.sharepoint.com/" ...
PowerShellCorpus/GithubGist/jballe_5fdd11cdacd540781105_raw_a49f20f3da23dfc9b3c2577eeeaef804142a28db_install.ps1
jballe_5fdd11cdacd540781105_raw_a49f20f3da23dfc9b3c2577eeeaef804142a28db_install.ps1
#chocolatey (iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')))>$null 2>&1 # now install cinst javaruntime-preventasktoolbar cinst javaruntime cinst git cinst hg cinst microsoft-build-tools cinst Thoughtworks.Go.Server -source 'https://www.myget.org/F/jballe-chocolatey/...
PowerShellCorpus/GithubGist/PaulStovell_b3e18ede1bf1cfe173b3_raw_b87b91c8b34fd80a823664f9063be29059b27196_Octopus.Features.IISWebSite_BeforePostDeploy.ps1
PaulStovell_b3e18ede1bf1cfe173b3_raw_b87b91c8b34fd80a823664f9063be29059b27196_Octopus.Features.IISWebSite_BeforePostDeploy.ps1
## -------------------------------------------------------------------------------------- ## Configuration ## -------------------------------------------------------------------------------------- $isEnabled = $OctopusParameters["Octopus.Action.IISWebSite.CreateOrUpdateWebSite"] if (!$isEnabled -or ![Bool]::Parse...
PowerShellCorpus/GithubGist/dotps1_709bf487ba5f9967b45f_raw_27b817006e03db3b87dca5f4cf72a32cde2da2f6_Convert-MACAddressDelimiter.ps1
dotps1_709bf487ba5f9967b45f_raw_27b817006e03db3b87dca5f4cf72a32cde2da2f6_Convert-MACAddressDelimiter.ps1
function Convert-MACAddressDelimiter { [CmdletBinding()] [OutputType([String])] Param ( [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [ValidateScript(...
PowerShellCorpus/GithubGist/janikvonrotz_8285809_raw_76a315da273d9360725a5ac15768665ef9d55dd8_Map-GroupMembershipByUsersDepartment.ps1
janikvonrotz_8285809_raw_76a315da273d9360725a5ac15768665ef9d55dd8_Map-GroupMembershipByUsersDepartment.ps1
Import-Module activedirectory $Groups = @( @{ Department = "Fahrdienst A" Group = "Fahrdienst A - Weickart Markus Gruppe" DistGroup = "Fahrdienst A - Weickart Markus" }, @{ Department = "Fahrdienst B" Group = "Fahrdienst B - Nietlispach Marco Gruppe" ...
PowerShellCorpus/GithubGist/adoprog_5606784_raw_2b0f5513260f8838ff996aa5a32176c04cc99dc5_gistfile1.ps1
adoprog_5606784_raw_2b0f5513260f8838ff996aa5a32176c04cc99dc5_gistfile1.ps1
$buildFolder = Resolve-Path .. $sourcePath = "$buildFolder\Output\LaunchSitecore.Build.12345.zip"
PowerShellCorpus/GithubGist/guitarrapc_9523d3c7dbb04b6bac71_raw_538b4afad3ce9513023b752dfb0b61fe0a6fcbe0_Foreach-Object%E3%81%A8Foreach%E3%81%AE%E7%BD%A0.ps1
guitarrapc_9523d3c7dbb04b6bac71_raw_538b4afad3ce9513023b752dfb0b61fe0a6fcbe0_Foreach-Object%E3%81%A8Foreach%E3%81%AE%E7%BD%A0.ps1
#region return の罠 1..3 | %{ return $_ } <# 1 2 3 #> foreach ($x in (1..3)) { return $x } <# 1 #> #endregion #region continue の罠 1..3 | %{ $_ continue } <# 1 #> foreach ($x in (1..3)) { $x continue } <# 1 2 3 #> #endregion #region break はふつー...
PowerShellCorpus/GithubGist/dfinke_6c4a7064651e66a4713d_raw_f5297b4dc6e0ed6867ce2970bfef45cabade0230_Get-GithubEmojis.ps1
dfinke_6c4a7064651e66a4713d_raw_f5297b4dc6e0ed6867ce2970bfef45cabade0230_Get-GithubEmojis.ps1
workflow Get-GithubEmojis { param($TargetPath="c:\temp\emojis") if(!(Test-Path -Path $TargetPath)) { $null= New-Item -ItemType Directory -Path $TargetPath } $emojis = Invoke-RestMethod -Uri https://api.github.com/emojis $names = ($emojis | Get-Member -MemberType NoteProper...
PowerShellCorpus/GithubGist/johndacosta_6080418_raw_14aaa2cc6c8f35413298ccacc1a8d51a4760b017_get-diskspace.ps1
johndacosta_6080418_raw_14aaa2cc6c8f35413298ccacc1a8d51a4760b017_get-diskspace.ps1
Get-WmiObject win32_volume | Select-Object SystemName,Name, BlockSize, Capacity, FreeSpace, DriveLetter , @{Name="CapacityGB";Expression={[math]::round($_.Capacity/1GB,2)}}, @{Name="FreeSpaceGB";Expression={[math]::round($_.FreeSpace/1GB,2)}} , @{Name="FreeSpacePercent";Expression={[math]::round(($_.FreeSpace/($_.Capac...
PowerShellCorpus/GithubGist/YoungjaeKim_4eb6359dd6076f3f74f7_raw_3583f1fe1129d018d1656c622df71ec90c0b2813_teamcity_azure_worker_role.ps1
YoungjaeKim_4eb6359dd6076f3f74f7_raw_3583f1fe1129d018d1656c622df71ec90c0b2813_teamcity_azure_worker_role.ps1
#Modified and simplified version of https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/ #Modified and treat error-terminating of http://weblogs.asp.net/srkirkland/ci-deployment-of-azure-web-roles-using-teamcity $ErrorActionPreference = "Stop" $subscription = "[Your Subscription Name]" $...
PowerShellCorpus/GithubGist/guitarrapc_a45f070be3301d27eb78_raw_8c80453e3395f4d50837c489dc75868550618517_break.ps1
guitarrapc_a45f070be3301d27eb78_raw_8c80453e3395f4d50837c489dc75868550618517_break.ps1
1..3 | %{ $_ break $_ } <# 1 #> foreach ($x in (1..3)) { $x break $x } <# 1 #>
PowerShellCorpus/GithubGist/mynameiscoffey_7002093_raw_19ed21ddcc03b1cbe4719a133f7b259dce540acb_deploy.ps1
mynameiscoffey_7002093_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].cs...
PowerShellCorpus/GithubGist/p0w3rsh3ll_a4e606996150b63ae54b_raw_46728caf493e5e8cdf81ec04784131809ee6d761_ProxyURL.ps1
p0w3rsh3ll_a4e606996150b63ae54b_raw_46728caf493e5e8cdf81ec04784131809ee6d761_ProxyURL.ps1
# Define a proxy URL for a configuration script Configuration ProxyURL { Registry ProxyPerMachinePolicy { Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings' ValueName = 'ProxySettingsPerUser' Ensure = 'Present' ...
PowerShellCorpus/GithubGist/andreaswasita_0386c773b9873e7cca88_raw_dd7029d8d27c3c6ec4187e29d6141b3d164c9450_Remove-AzureAntiMalware.ps1
andreaswasita_0386c773b9873e7cca88_raw_dd7029d8d27c3c6ec4187e29d6141b3d164c9450_Remove-AzureAntiMalware.ps1
$servicename = "MyAzureVMAntiMalware" $name = "MyAzureVM01" Get-AzureVM -ServiceName $servicename -Name $name | Set-AzureVMExtension -Publisher Microsoft.Azure.Security -ExtensionName IaaSAntimalware -Version 1.* -Uninstall | Update-AzureVM
PowerShellCorpus/GithubGist/belotn_6867957_raw_9f37f62cd12396ae786391d159b330860179a787_Disbale-GPOUnusedPart.ps1
belotn_6867957_raw_9f37f62cd12396ae786391d159b330860179a787_Disbale-GPOUnusedPart.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 -...
PowerShellCorpus/GithubGist/toddb_1133511_raw_45404dbfa3c115ced13c44aa7a91b41e87177f34_build-tasks.ps1
toddb_1133511_raw_45404dbfa3c115ced13c44aa7a91b41e87177f34_build-tasks.ps1
<# Basic build tasks for SharePoint (or other projects) - using 7zip and GacUtil $framework = '4.0x64' . .\scripts\build-tasks.ps1 properties { $project = "Sites" $environment = "" # handed in commmand line $revision = "0" # handed in commmand line $version = "1.0.0." # pro...
PowerShellCorpus/GithubGist/mrlesmithjr_7954983_raw_c07172bce60ac13fedddd87e16919ea4ea7e19d1_Get_VM_Network.ps1
mrlesmithjr_7954983_raw_c07172bce60ac13fedddd87e16919ea4ea7e19d1_Get_VM_Network.ps1
#Provided by @mrlesmithjr #EveryThingShouldBeVirtual.com # # Set variable for all VMs that are powered on $vms = Get-vm | where { $_.PowerState -eq “PoweredOn”} # Capture default info Get-VMGuestNetworkInterface $vms # Capture more details - Only works for Windows VMs Get-VMGuestNetworkInterface $vms | Select...
PowerShellCorpus/GithubGist/xinhuang_11347412_raw_9a20ec3374212ee6cd114ff4a4011b489cbee8a3_rc.ps1
xinhuang_11347412_raw_9a20ec3374212ee6cd114ff4a4011b489cbee8a3_rc.ps1
param( [switch]$install ) function Try-ImportModule($module, [ScriptBlock]$onError) { try { Import-Module $module -ErrorAction Stop } catch { & $onError Import-Module $module } } Try-ImportModule 'PsGet' -OnError { (new-object Net.WebClient).DownloadString("http://psget.net/GetPsG...
PowerShellCorpus/GithubGist/Rodske_0898e6b36b6ce4c84585_raw_a693c0538b8b5a463ae84e139b15b59f74856cc0_GenerateSqlObjects.ps1
Rodske_0898e6b36b6ce4c84585_raw_a693c0538b8b5a463ae84e139b15b59f74856cc0_GenerateSqlObjects.ps1
# Adapted from http://www.simple-talk.com/sql/database-administration/automated-script-generation-with-powershell-and-smo/ <# .SYNOPSIS Generate file-per-object scripts of specified server and database. .DESCRIPTION Generate file-per-object scripts of specified server and database to specified directory. Att...
PowerShellCorpus/GithubGist/tcshao_3797240_raw_abd040954c15390d8d52f21109d7da757aaf42f6_DeleteOldTextFiles.ps1
tcshao_3797240_raw_abd040954c15390d8d52f21109d7da757aaf42f6_DeleteOldTextFiles.ps1
<# Deleting *.txt files from 'c:\temp' and subdirectories more than 5 days old #> Get-ChildItem 'C:/temp' -Recurse -Include '*txt' | WHERE { ($_.CreationTime -le $(Get-Date).AddDays(-5)) } | Remove-Item
PowerShellCorpus/GithubGist/CodeAndLoathing_37be9c54b545eb93b1fc_raw_f5c712103e3981c5f6a58ef69fdc419d682edf23_AD-verifyUserOrGroupExists.ps1
CodeAndLoathing_37be9c54b545eb93b1fc_raw_f5c712103e3981c5f6a58ef69fdc419d682edf23_AD-verifyUserOrGroupExists.ps1
# query list of usernames and/or groups and determine if they exist in specified AD domain or not # tested against Powershell 4.0 # parameters $domain = "example.com" $userList = @('username1','username2','username3...') $groupList = @('groupname1','groupname2','groupname3...') # result vars $unknownUserList...
PowerShellCorpus/GithubGist/nich0s_6104726_raw_8bebfd8b0a77ad64deec5b46b374f50e70a08a6f_gui_form_template.ps1
nich0s_6104726_raw_8bebfd8b0a77ad64deec5b46b374f50e70a08a6f_gui_form_template.ps1
<# name: gui_form_template.ps1 auth: nich0s desc: Template for building GUIs in PowerShell. #> # Imports Import-Module SomethingWindowsy # Main function function GenerateForm { [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null [reflection.assembly]::loadwith...
PowerShellCorpus/GithubGist/guitarrapc_77c1b0dc0ab0564c46d9_raw_606bb001d69a0eb87da5f5047e95b2bba9a2fa4d_PartialExpression.ps1
guitarrapc_77c1b0dc0ab0564c46d9_raw_606bb001d69a0eb87da5f5047e95b2bba9a2fa4d_PartialExpression.ps1
#3. $() でくくる。部分式扱いなので、先行評価、展開される "$($hoge.hoge)"
PowerShellCorpus/GithubGist/justFen_2782653_raw_153e0a724b27f57f7eabf2913867eff416343e28_AutoVM.ps1
justFen_2782653_raw_153e0a724b27f57f7eabf2913867eff416343e28_AutoVM.ps1
param ( [string]$vmName = (Read-Host "Provide VM Name"), [string]$Template = (Read-Host "What Template do you want Vanilla/Web/Gravis?") [string]$Template = (Read-Host "Disk size 40/80?") ) # Import Configuration . (Join-Path -Path (Split-Path -parent $MyInvocation.MyCommand.Definition) -ChildPath "...
PowerShellCorpus/GithubGist/akimboyko_4258647_raw_a6643cf56090e1101598fdb5259cbeebf8f22f8d_gistfile1.ps1
akimboyko_4258647_raw_a6643cf56090e1101598fdb5259cbeebf8f22f8d_gistfile1.ps1
Write-Host 'throw' try { try { throw "exception" } catch { Write-Host $_ Write-Host $_.GetType() Write-Host $_.Exception Write-Host $_.Exception.StackTrace throw } } catch { Write-Host $_ Write-Host $_.GetType() Write-Host $_.Exception Write-Host $_.Exception.StackTrace Write-Host $err } Write-...
PowerShellCorpus/GithubGist/minakuchiya_5459133_raw_f93daed8a8f6de1a25dd5fb0b976a0ba7b1714d5_Waei.ps1
minakuchiya_5459133_raw_f93daed8a8f6de1a25dd5fb0b976a0ba7b1714d5_Waei.ps1
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Web") function waei($value) { $value = [Web.HttpUtility]::UrlEncode($value) ie http://dictionary.goo.ne.jp/srch/je/$value/m0u/ }
PowerShellCorpus/GithubGist/philipmat_8a292387dcef0bad9404_raw_9f9bf1b4d470e9bd67b871d52915ef16e43d68fa_recover.ps1
philipmat_8a292387dcef0bad9404_raw_9f9bf1b4d470e9bd67b871d52915ef16e43d68fa_recover.ps1
# Usage: (execute in the .git/objects folder) # recover.ps1 -startDate "8/13/2014 1:22:00pm" -endDate "8/13/2014 8:00:00pm" > borked_files.txt [CmdletBinding()] Param( [string]$startDate, [string]$endDate ) $start = [datetime]::Today if ($startDate) { $start = [datetime]::Parse($startDate) } $end = $s...
PowerShellCorpus/GithubGist/timheuer_3422592_raw_d2acb885b7a73d73bf27a997c897ed83944a8f92_gistdiff.ps1
timheuer_3422592_raw_d2acb885b7a73d73bf27a997c897ed83944a8f92_gistdiff.ps1
# ask the user for a gist name param ( [string]$gistname = "$(Read-Host 'Enter a name for the gist')" ) # constant $gistapi = "https://api.github.com/gists" $filename = $gistname + '.diff' $teststring = "`{`"description`": `"the description for this gist`",`"public`": true,`"files`": `{`"file1.txt`": `{`"c...
PowerShellCorpus/GithubGist/RamblingCookieMonster_558007250a0380b94ac4_raw_33026e7e0516ecb7eb509446982c8777ae314d0b_Test-Pipeline.ps1
RamblingCookieMonster_558007250a0380b94ac4_raw_33026e7e0516ecb7eb509446982c8777ae314d0b_Test-Pipeline.ps1
<# This function and following examples illustrate the implementation of two helpful scenarios: Pipeline input, with verbose output describing the values and types within the Begin, Process, and End blocks ShouldProcess support, with friendly bypass handling using a Force switch. #...
PowerShellCorpus/GithubGist/mortenya_ffd155fb325958076312_raw_952d39561d33010672aa17a7a2f320482866524b_Get-LoggedOnUserSession.ps1
mortenya_ffd155fb325958076312_raw_952d39561d33010672aa17a7a2f320482866524b_Get-LoggedOnUserSession.ps1
function get-loggedonuser ($computername){ #mjolinor 3/17/10 $regexa = '.+Domain="(.+)",Name="(.+)"$' $regexd = '.+LogonId="(\d+)"$' $logontype = @{ "0"="Local System" "2"="Interactive" #(Local logon) "3"="Network" # (Remote logon) "4"="Batch" # (Scheduled task) "5"="Service" # (Service acc...
PowerShellCorpus/GithubGist/smasterson_9141216_raw_b5c35083d9c532f2584fc0854ed3ecbccb69960a_ChangePwd.ps1
smasterson_9141216_raw_b5c35083d9c532f2584fc0854ed3ecbccb69960a_ChangePwd.ps1
# # ChangePwd # # Author: Shawn Masterson # Created: June 2013 # Version: 1 # # Purpose: Change local Windows account passwords on remote systems located in a vSphere folder # # # Arguments: # -vCenter - vCenter Server FQDN or IP # -VMFolder - vCenter folder containing VMs...
PowerShellCorpus/GithubGist/pcgeek86_945f327819dedc2378c3_raw_b2bcb0e9f32e032e58bb19734867dcf054d9c638_DSC-NewAzureVM.ps1
pcgeek86_945f327819dedc2378c3_raw_b2bcb0e9f32e032e58bb19734867dcf054d9c638_DSC-NewAzureVM.ps1
#region Subscription $SubscriptionName = 'Visual Studio Ultimate with MSDN'; Select-AzureSubscription -SubscriptionName $SubscriptionName; #endregion #region Affinity Group $AffinityGroup = @{ Name = 'powershelldsc'; Location = 'North Central US'; }; if (!(Get-AzureAffinityGroup -Name $AffinityGr...
PowerShellCorpus/GithubGist/anderssonjohan_4738733_raw_02e02488679b99f32922cef516af1cc4f99f10a5_testargs.ps1
anderssonjohan_4738733_raw_02e02488679b99f32922cef516af1cc4f99f10a5_testargs.ps1
param( [string] $foo, [int] $bar ) $arguments = "" # Change to $PSBoundParameters.. $MyInvocation.BoundParameters.Keys | %{ Write-Host "key $_" # $MyInvocation.BoundParameters.Item( string key ) fails in PowerShell 3.0: # $paramValue = $MyInvocation.BoundParameters.Item( $_ ) # # Exception getting "Item": "The g...
PowerShellCorpus/GithubGist/AmrEldib_3581c3aff5aee81dc2f9_raw_9031f8537e6b49b0aeb5eeec40772662944155fc_GetChildItem.ps1
AmrEldib_3581c3aff5aee81dc2f9_raw_9031f8537e6b49b0aeb5eeec40772662944155fc_GetChildItem.ps1
Get-ChildItem | out-file "D:\MyOutputFile.txt" -Append -Force
PowerShellCorpus/GithubGist/trondhindenes_948ee0aa0ef99b5ee1d7_raw_4aeeba05b28a01686e64d40c54e44fbcac1dc89a_generateDBs.ps1
trondhindenes_948ee0aa0ef99b5ee1d7_raw_4aeeba05b28a01686e64d40c54e44fbcac1dc89a_generateDBs.ps1
$Folders = get-childitem *db* -path "D:\MDB" -Recurse foreach ($folder in $folders) { $DBName = $folder.Name $ExchangeServer = $DBName.split("-")[0] $LogFolderPath = $folder.Fullname.Replace("DB","LOG") $edbfilepath = "$($folder.FullName)\$DBName.edb" if (!(get-mailboxdatabase $DBName -erro...
PowerShellCorpus/GithubGist/belotn_6827958_raw_8ca6659a8b6502128faa7885b901b3d1069eb96c_get-emptygpo2.ps1
belotn_6827958_raw_8ca6659a8b6502128faa7885b901b3d1069eb96c_get-emptygpo2.ps1
Get-ADObject -Filter 'ObjectClass -eq "groupPolicyContainer"' -SearchBase 'CN=Policies,CN=System,DC=fabrikam,DC=com' |% { Get-Adobject $_.distinguishedName -properties * } |?{ [bool]( gci "$($_.gPCFileSysPath)\User") -eq $false -and [bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false } | select DisplayName
PowerShellCorpus/GithubGist/jonschoning_5306402_raw_a2c6198dc394bd6c9a56b7cd3b51b83d1187730b_select-not-match.ps1
jonschoning_5306402_raw_a2c6198dc394bd6c9a56b7cd3b51b83d1187730b_select-not-match.ps1
Function select-not-match ($filter, $pattern) { Get-ChildItem -Filter $filter -Recurse | Where-Object { !(Select-String -Path $_.fullname -Pattern $pattern -SimpleMatch -Quiet) } | select fullname }