full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/GithubGist/charlieoleary_1d986491b88420dcd5ca_raw_5bbb8c29151deb81dcdd7bda816aad7bd7581f72_dropTranscode.ps1
charlieoleary_1d986491b88420dcd5ca_raw_5bbb8c29151deb81dcdd7bda816aad7bd7581f72_dropTranscode.ps1
# Clear the screen Clear-Host # Number of Seconds $secondsOlder = 15 # Time Between Checks $sleepTime = 5 $ffmbcPath = "c:\bin\Debug\ffmbc.exe" # Path to Watch $srcPath = Read-Host "Full path of directory to be watched: " # Path to Drop $dstPath = Read-Host "Location where transcoded files will be ...
PowerShellCorpus/GithubGist/briped_dc9e8c6f30caf703688e_raw_c618267b086c357ca8ce12561277ebcafae59b7c_Merge-ADGroupMembers.ps1
briped_dc9e8c6f30caf703688e_raw_c618267b086c357ca8ce12561277ebcafae59b7c_Merge-ADGroupMembers.ps1
Param( [parameter(Mandatory=$true, HelpMessage="Enter one or more AD groups to merge/copy from.")] [string[]] $SourceGroups, [parameter(Mandatory=$true, HelpMessage="Enter AD group to merge/copy to.")] [string] $TargetGroup, [parameter(Mandatory=$fals...
PowerShellCorpus/GithubGist/tamagokun_3004344_raw_8712e4cd917f8e31a59c7cdb83aa1bb1ed50ea30_sync.ps1
tamagokun_3004344_raw_8712e4cd917f8e31a59c7cdb83aa1bb1ed50ea30_sync.ps1
function sync_dir { Param($src,$dest,[switch]$whatif) # Make sure destination exists if(!(test-path -literalPath $dest)) { Write-Host "Creating destination directory." New-Item $dest -type Directory -force | out-Null } $regex_src_path = $src -replace "\\","\\" -replace "\:","\:" $regex_...
PowerShellCorpus/GithubGist/ashwin_3269777_raw_7cf54d4d3eeac5135f0c027e25a75a4db3f0b8cb_gistfile1.ps1
ashwin_3269777_raw_7cf54d4d3eeac5135f0c027e25a75a4db3f0b8cb_gistfile1.ps1
# Delete page 170 from foo.djvu djvm -d foo.djvu 170 # Delete pages 170-174 from foo.djvu for ( $i = 0; $i -lt 5; $i++ ) { djvm -d foo.djvu 170 }
PowerShellCorpus/GithubGist/ianblenke_87a042abdd0102343386_raw_705872070981b140095547630d17a2dcb3b3e7cc_Bootstrap-EC2-Windows-CloudInit.ps1
ianblenke_87a042abdd0102343386_raw_705872070981b140095547630d17a2dcb3b3e7cc_Bootstrap-EC2-Windows-CloudInit.ps1
# Copied shamelessly from: https://gist.githubusercontent.com/masterzen/6714787/raw/3166173255caef341f578e1ea3fff1eea3072d5b/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 EC...
PowerShellCorpus/GithubGist/zhujo01_e10d69ec4b1249c3c5e3_raw_a50bb1b433ec397ed7a40395f16b9d84ff2cd758_amazon-openstack.ps1
zhujo01_e10d69ec4b1249c3c5e3_raw_a50bb1b433ec397ed7a40395f16b9d84ff2cd758_amazon-openstack.ps1
######################################################################## # AWS EC2 Windows Bootstrapping Script # Supported OS: # - Windows 2008 Server R2 SP1 (TESTED) # - Windows 2008 Server (TO BE TESTED) # - Windows 2012 Server (TO BE TESTED) # Image Transformation Target Cloud # - Openstack ...
PowerShellCorpus/GithubGist/johntseng_62b90f4df5bc595db55e_raw_388d018e61a818d78209092f26121fef3fd8f87d_gistfile1.ps1
johntseng_62b90f4df5bc595db55e_raw_388d018e61a818d78209092f26121fef3fd8f87d_gistfile1.ps1
param([string]$filename, [string]$fullname) $tempZ = "c:\temp\$filename.7z" if (!(get-S3Object -BucketName database-backups -key (split-path $tempZ -leaf))) { exit 1 } Read-S3Object -BucketName database-backups -key (split-path $tempZ -leaf) -File $tempZ C:\7za.exe x $tempZ mv "$filename" "$fullname" ...
PowerShellCorpus/GithubGist/forsythetony_0c43e8a9305c0a3867ba_raw_277a382a15d7512266ac51dc3376c1862e7c42e6_gettingFiles.ps1
forsythetony_0c43e8a9305c0a3867ba_raw_277a382a15d7512266ac51dc3376c1862e7c42e6_gettingFiles.ps1
function updateFilesInRange($range) { $pathToFiles = $range.folderPath # Selection all items within the $pathToFiles directory that meet the following conditions... # 1. It is not a directory # 2. It was created after the start of the date range # 3. It was created before the end of...
PowerShellCorpus/GithubGist/colinbowern_6314743_raw_310043826e36e6de1a1546e125f97fc2f530c06e_Update-ADObjects.ps1
colinbowern_6314743_raw_310043826e36e6de1a1546e125f97fc2f530c06e_Update-ADObjects.ps1
# Reads CSV generated by CSVDE and updates the properties for Active Directory User param([Parameter(Position=0, Mandatory=$true)] $FileName) $ReadOnlyProperties = "DN", "objectClass", "sAMAccountName" Write-Host "Reading from $FileName" $UserRecords = Import-Csv $FileName foreach($UserRecord in $UserRecords) ...
PowerShellCorpus/GithubGist/taddev_3962965_raw_35a03d6541b8cda59a0e42052de4d5b896e94bca_RunElevated.ps1
taddev_3962965_raw_35a03d6541b8cda59a0e42052de4d5b896e94bca_RunElevated.ps1
# # Author: Tad DeVries # Email: taddevries@gmail.com # FileName: RunElevated.ps1 # # Description: # Creates a "sudo" like command to elevate another # command to administrative level. This is used to # simplify the CLI interaction and create a little # home like feeling for the *nix users out there. # # # ...
PowerShellCorpus/GithubGist/posaunehm_3753947_raw_4eae963ad67a84d776ddb13acad79b5a961f1fc3_gistfile1.ps1
posaunehm_3753947_raw_4eae963ad67a84d776ddb13acad79b5a961f1fc3_gistfile1.ps1
ls *.bmp | sort -Property Length -Unique | % -begin{$i = 0} -process{ren $_ ("Image" + $i.ToString() + ".bmp");$i += 1 }
PowerShellCorpus/GithubGist/bradmurray_4723664_raw_6ef80d30c652593d4a112625ada6f91ac709b3a8_CopyToBitcasa.ps1
bradmurray_4723664_raw_6ef80d30c652593d4a112625ada6f91ac709b3a8_CopyToBitcasa.ps1
# Usage: CopyToBitcasa FileSpec [-move] [-dir=DestinationDirectory] # FileSpec: A file to copy/move (accepts wildcards) # -move: File(s) will be moved to the Bitcasa directory # -dir: The directory beneath $BitcasaDirectory that where the files(s) will go. If omitted copy will go to the root. This directory mu...
PowerShellCorpus/GithubGist/jstangroome_3522474_raw_8229b7015c324491e53b73c89c0187e74ec767a4_LazyProperty.ps1
jstangroome_3522474_raw_8229b7015c324491e53b73c89c0187e74ec767a4_LazyProperty.ps1
function Add-LazyProperty { [CmdletBinding()] param ( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] [PSObject] $InputObject, [Parameter(Mandatory=$true, Position=1)] [string] $Name, [Parameter(Mandatory=$true, Position=2)] [Sc...
PowerShellCorpus/GithubGist/mmdemirbas_5229315_raw_dda918f6778dfa67f4fee80287d855c86f61d235_set-ntfs-ro.ps1
mmdemirbas_5229315_raw_dda918f6778dfa67f4fee80287d855c86f61d235_set-ntfs-ro.ps1
######################################################################### # # # Script to set or clear read-only flag of an NTFS volume. # # # # Usage: .\set-nt...
PowerShellCorpus/GithubGist/gravejester_6bc472fcf60ca3f0eeef_raw_1314c8bd2fcb035d16820f92476a41fa73bb91fa_Show-Calendar.ps1
gravejester_6bc472fcf60ca3f0eeef_raw_1314c8bd2fcb035d16820f92476a41fa73bb91fa_Show-Calendar.ps1
function Show-Calendar { <# .SYNOPSIS Show calendar. .DESCRIPTION This function is a PowerShell version of the *NIX cal command and will show a calendar of the chosen month(s). The current day will be marked with a '*'. For best results, use t...
PowerShellCorpus/GithubGist/klumsy_1f84fea3fb1de7a2e75b_raw_1c6608e204bbf637660dce53092e67bae13a2fbc_PurgeRabbitQueues.ps1
klumsy_1f84fea3fb1de7a2e75b_raw_1c6608e204bbf637660dce53092e67bae13a2fbc_PurgeRabbitQueues.ps1
$rabbitserver = 'localhost:15672' $cred = Get-Credential iwr -ContentType 'application/json' -Method Get -Credential $cred "http://${rabbitserver}/api/queues" | % { ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % { iwr -method DELETE -Credential $cred -uri $("http://${rabbits...
PowerShellCorpus/GithubGist/shiranGinige_3760691_raw_2b54199a759ab11c259987a5a629140cc24aa8b7_FindProjectsWithGivenReference.ps1
shiranGinige_3760691_raw_2b54199a759ab11c259987a5a629140cc24aa8b7_FindProjectsWithGivenReference.ps1
# Calling Convention # FindReference.ps1 "log4net" param([String]$ReferenceToFind ) $xmlns = "http://schemas.microsoft.com/developer/msbuild/2003" $projects = ls -r -i *.csproj foreach($projectPath in $projects) { $proj = [string](Get-Content $projectPath) $containsReference = $proj.ToLow...
PowerShellCorpus/GithubGist/jstangroome_1715073_raw_b71180d1fb071d77a7f6b4d624e02909eb9025f6_Export-TfsBuildDefinition.ps1
jstangroome_1715073_raw_b71180d1fb071d77a7f6b4d624e02909eb9025f6_Export-TfsBuildDefinition.ps1
[CmdletBinding()] param( [Parameter(Mandatory = $true)] [ValidatePattern('^https?://')] [string] $CollectionUri, [string] $ProjectName = '*', [Alias('Name')] [string] $BuildDefinitionName = '*' ) function New-TypedObject ( [string] $TypeName, [hashtable] $...
PowerShellCorpus/GithubGist/hsteinhilber_914627_raw_f879b7a361268892ed45b6ab134a68a60da636de_profile.ps1
hsteinhilber_914627_raw_f879b7a361268892ed45b6ab134a68a60da636de_profile.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) $env:Path += ";c:\Git\cmd"; # Load posh-git module from current directory Import-Module posh-git # Adjust colors for git prompt $GitPromptSettings.BeforeForegroundColor = [ConsoleColor]::DarkCyan $GitPromptSettings.DelimForegroundCo...
PowerShellCorpus/GithubGist/ao-zkn_1a26a755d47148ed807e_raw_385e6e2c29554674369e0625d258e37102975c96_Copy-ImagesByDateTimeOriginal.ps1
ao-zkn_1a26a755d47148ed807e_raw_385e6e2c29554674369e0625d258e37102975c96_Copy-ImagesByDateTimeOriginal.ps1
# ------------------------------------------------------------------ # 画像ファイル(jpeg,jpg)を撮影日ごとにフォルダ分けする # 関数名:Copy-ImagesByDateTimeOriginal # 引数 :CopyFolderPath コピー元のフォルダパス # :DestFolderPath コピー先のフォルダパス # 戻り値:なし # ------------------------------------------------------------------ function Copy-ImagesByDateTimeOrigi...
PowerShellCorpus/GithubGist/Wimpje_a796ba134d61552587a7_raw_81d15917859fed17f4bf3827ba20e5a7fafd9e7e_SplitXml.ps1
Wimpje_a796ba134d61552587a7_raw_81d15917859fed17f4bf3827ba20e5a7fafd9e7e_SplitXml.ps1
param( [string]$file = $(throw "file is required"), $matchesPerSplit = 50, $maxFiles = [Int32]::MaxValue, $splitOnNode = $(throw "splitOnNode is required"), $offset = 0 ) # with a little help of https://gist.github.com/awayken/5861923 $ErrorActionPreference = "Stop"; trap { $ErrorActionPreference = "Continue...
PowerShellCorpus/GithubGist/guitarrapc_3d1af4a26d023bb5c005_raw_6c1cbc31034902f1b23e63ce6fd773595f0f59dc_StringEvaluationItem.ps1
guitarrapc_3d1af4a26d023bb5c005_raw_6c1cbc31034902f1b23e63ce6fd773595f0f59dc_StringEvaluationItem.ps1
# 例 $hoge = @{hoge = "hoge"} $fuga = "fuga"
PowerShellCorpus/GithubGist/snapcase_b7dbd396951d1b7b6a78_raw_b79041910d668b7a83519dccf849cf73a8ceaa45_nauts-FixReplays.ps1
snapcase_b7dbd396951d1b7b6a78_raw_b79041910d668b7a83519dccf849cf73a8ceaa45_nauts-FixReplays.ps1
#REQUIRES -Version 2.0 <# .SYNOPSIS Convert non-ascii Replays.info files to ascii so that they can be read by the game .DESCRIPTION When you enter "Replays" from the main menu a file called "Replays.info" will be populated with data about replays. In the occurence of unicode or other non-ascii character it wi...
PowerShellCorpus/GithubGist/seraphy_4674696_raw_e1173acd4ce75fd2cdb8462ecb45ae252a4fa793_sha1sum.ps1
seraphy_4674696_raw_e1173acd4ce75fd2cdb8462ecb45ae252a4fa793_sha1sum.ps1
# 第一引数として、対象となるファイルまたは親ディレクトリを指定する. # 省略時はカレントディレクトリ以下のすべてのファイルを対象とする. param($searchPath = $(pwd)) # バイト配列を16進数文字列に変換する. function ToHex([byte[]] $hashBytes) { $builder = New-Object System.Text.StringBuilder $hashBytes | %{ [void] $builder.Append($_.ToString("x2")) } $builder.ToString() } # 指定...
PowerShellCorpus/GithubGist/fimcookbook_5557196_raw_99b3b112f6bb33a26933d50913b750ed4ca7f37e_UnProtect-SecretWithMachineKey.ps1
fimcookbook_5557196_raw_99b3b112f6bb33a26933d50913b750ed4ca7f37e_UnProtect-SecretWithMachineKey.ps1
function unprotectSecretWithMachineKey { [CmdletBinding()] param( [Parameter(Mandatory=$True, ValueFromPipeline=$True)] [string] $secret ) BEGIN{ Add-Type -AssemblyName System.Web $utf8Encoder = New-Object System.Text.UTF8Encoding } PROCESS { $protectedSecretBytes = [Convert]::FromBase64String(...
PowerShellCorpus/GithubGist/vinyar_311c78091e7e1d1f86ff_raw_734fa69ed67c5a478ad525ffdc5bbea5ec9741ae_HKLM%20auditpolicy.ps1
vinyar_311c78091e7e1d1f86ff_raw_734fa69ed67c5a478ad525ffdc5bbea5ec9741ae_HKLM%20auditpolicy.ps1
# $sddl = 'O:BAG:SYD:PAI(A;CI;KA;;;CO)(A;CI;KA;;;SY)(A;CI;KA;;;BA)(A;CI;KR;;;BU)(A;CI;KR;;;AC)S:AI(AU;CISA;KA;;;WD)' # alternative just in case $acl = get-acl HKLM:\\SOFTWARE -audit $audit = "Everyone","FullControl","containerinherit","none","Fail" $rule = new-object system.security.accesscontrol...
PowerShellCorpus/GithubGist/tanaka-takayoshi_6567570_raw_742090f181cfb4a95ee41700e556acb11d57158b_Add-Routing.ps1
tanaka-takayoshi_6567570_raw_742090f181cfb4a95ee41700e556acb11d57158b_Add-Routing.ps1
Install-WindowsFeature RemoteAccess -IncludeManagementTools Add-WindowsFeature -name Routing -IncludeManagementTools Restart-Computer
PowerShellCorpus/GithubGist/Novakov_5487789_raw_94951ad6041520701754fcbcaf45c662c0fc5cd1_merge.ps1
Novakov_5487789_raw_94951ad6041520701754fcbcaf45c662c0fc5cd1_merge.ps1
param([string]$repo, [string]$source,[string]$dest) $base = "$/MAPS Onboard/Dev/$repo" set-alias tf 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TF.exe' tf get /recursive "$base/$source" tf merge /recursive "$base/$source" "$base/$dest" tf checkin /comment:"merge $source -> $dest" ...
PowerShellCorpus/GithubGist/zachbonham_5082482_raw_1d7736a0f8586127ac581486549a032590899519_hello.ps1
zachbonham_5082482_raw_1d7736a0f8586127ac581486549a032590899519_hello.ps1
write-host "machine $($env:computername)" write-host "hello, $($env:computername) "
PowerShellCorpus/GithubGist/belotn_8418024_raw_54a85031f0a5ab90b774de89e928982beeedc6e1_list_session.ps1
belotn_8418024_raw_54a85031f0a5ab90b774de89e928982beeedc6e1_list_session.ps1
get-xaserver -FolderPAth $FOLDERPATH |% { $sv = $_.ServerName; quser /SERVER:$($_.serverNAme) |% { $arrT = @( $_ -Split ' ' |? { $_ -ne ' '-and $_.length -gt 0 } ); new-object PSobject -property @{"Session" = $arrT[1]; "Inact" = $arrT[6]; "ServerName" = $sv} } } |? { $_.Session -ne 'SESSION' } | sort Inac...
PowerShellCorpus/GithubGist/rysstad_10370591_raw_1f3278116a3a9f5caad57aa189fe467b7fd563f5_Set-PowershellWindowProperties.ps1
rysstad_10370591_raw_1f3278116a3a9f5caad57aa189fe467b7fd563f5_Set-PowershellWindowProperties.ps1
# Create object reference to Get-Host $pshost = get-host # create reference to the console’s UI.RawUI child object $pswindow = $pshost.ui.rawui # Adjust the buffer first: $newsize = $pswindow.buffersize $newsize.height = 9999 $newsize.width = 200 $pswindow.buffersize = $newsize # Adjust the Window size $newsi...
PowerShellCorpus/GithubGist/guitarrapc_bfdaee4a9c368c869f96_raw_8e85a032087750c8002585106d1b23e7f004b04e_ACLTest.ps1
guitarrapc_bfdaee4a9c368c869f96_raw_8e85a032087750c8002585106d1b23e7f004b04e_ACLTest.ps1
configuration ACLTest { Import-DscResource -ModuleName GraniResource $path = "D:\Test" File test { DestinationPath = $path Ensure = "Present" Type = "Directory" } cACL test { Path = $path Account = "everyone" Rights = "FullC...
PowerShellCorpus/GithubGist/jbarber_464354_raw_1478714a9bffa8721d95eed78a022cba23ecf8bf_have_ballooned.ps1
jbarber_464354_raw_1478714a9bffa8721d95eed78a022cba23ecf8bf_have_ballooned.ps1
# Find all of the VMs that have experienced ballooning in the last day function ballooned? ($vm) { $d = Get-Stat -memory -entity $vm -start (Get-Date).AddDays(-1) | ?{ $_.MetricId -eq 'mem.vmmemctl.average' } | ?{ $_.value -ne 0 } return $d.count -ne 0 } connect-viserver -server virtualcenter -cred...
PowerShellCorpus/GithubGist/roberto-reale_9b3c601dcfe7acef5f0c_raw_35b9a0e30236c49ad09ac60f60b1a774c35c11cb_trabb_pardo_knuth.ps1
roberto-reale_9b3c601dcfe7acef5f0c_raw_35b9a0e30236c49ad09ac60f60b1a774c35c11cb_trabb_pardo_knuth.ps1
# # Trabb Pardo–Knuth algorithm # # see http://rosettacode.org/wiki/Trabb_Pardo%E2%80%93Knuth_algorithm # function TPK_function($x) { return [math]::pow([math]::abs($x), .5) + 5 * [math]::pow($x, 3) } function TPK([string] $f) { [double[]] $values # ask for 11 numbers to be read into a s...
PowerShellCorpus/GithubGist/707cf2eeb1_11185851_raw_5e262bd56d9e6704f405f5a94dd8f3506c16c88e_gistfile1.ps1
707cf2eeb1_11185851_raw_5e262bd56d9e6704f405f5a94dd8f3506c16c88e_gistfile1.ps1
Get-Mailbox | Search-Mailbox -SearchQuery кому:. -DeleteContent -SearchDumpstersOnly
PowerShellCorpus/GithubGist/nlarkin_6357491_raw_7f070c4b8ec78166f1c4ad3adbac45cbdab750ab_gettaxonomyterm.ps1
nlarkin_6357491_raw_7f070c4b8ec78166f1c4ad3adbac45cbdab750ab_gettaxonomyterm.ps1
Function GetTaxonomyTerm($spsite, $field, $label) { Write-Host "Getting term for $($label)..." $taxonomySession = Get-SPTaxonomySession -Site $spsite $taxonomyField = $spsite.RootWeb.Fields.GetField($field) $termStoreID = $taxonomyField.SspId $termStore = $taxonomySession.TermStores[$termStoreID] ...
PowerShellCorpus/GithubGist/mwrock_5130865_raw_a81f0f70648db3e9da1683dffa48a030c56f6152_gistfile1.ps1
mwrock_5130865_raw_a81f0f70648db3e9da1683dffa48a030c56f6152_gistfile1.ps1
#Get Boxstarter on RemotePC CINST Boxstarter.Chocolatey Import-Module Boxstarter.Chocolatey #Create minimal nuspec and chocolateyInstall New-BoxstarterPackage MyPackage #Edit Install script Notepad Join-Path $Boxstarter.LocalRepo "tools\ChocolateyInstall.ps1" #Pack nupkg Invoke-BoxstarterBuild MyPackage #share...
PowerShellCorpus/GithubGist/taomaree_7213105_raw_8c3ffca5c6b5532deac1995bcb4fe34a510fe0e0_backup-mssql.ps1
taomaree_7213105_raw_8c3ffca5c6b5532deac1995bcb4fe34a510fe0e0_backup-mssql.ps1
# run first by administrator : # set-executionpolicy remotesigned $timestr=get-date -uformat "%Y-%m-%d-%H-%M-%S" $tsql="" $prefix="D:\sqlbackup\" $filepath=$prefix + $timestr + "\" if (! ( Test-Path $filepath)) {mkdir $filepath } #if (! (Test-Path D:\sqlbackuptsql) ) {mkdir D:\sqlbackuptsql } function ba...
PowerShellCorpus/GithubGist/JeremySkinner_411950_raw_bb103fe04fe3fe257a900d178070cdcee0b1fb47_Profile.ps1
JeremySkinner_411950_raw_bb103fe04fe3fe257a900d178070cdcee0b1fb47_Profile.ps1
# First you'll need to download posh-hg from one of the following locations: # http://github.com/JeremySkinner/posh-hg # http://poshhg.codeplex.com # Add the following code to your profile.ps1 (usually in C:\Users\User\Documents\WindowsPowershell) # Import the posh-hg module from wherever it is saved Import-Mo...
PowerShellCorpus/GithubGist/racingcow_3e099ee7dc4ad3e4c8ae_raw_8deb68d366928696bc7ac940214cae931c8beb5a_salesmachine.ps1
racingcow_3e099ee7dc4ad3e4c8ae_raw_8deb68d366928696bc7ac940214cae931c8beb5a_salesmachine.ps1
############################################################ # Join domain ############################################################ #Rename-Computer -NewName devmachine -LocalCredential admin #Add-Computer -DomainName CT -Credential CT\dmiller #########################################################...
PowerShellCorpus/GithubGist/nonprofittechy_1f8123f79166241575fa_raw_3a0e21487c37dcee4be981d2051cdfe45bb85d22_gistfile1.ps1
nonprofittechy_1f8123f79166241575fa_raw_3a0e21487c37dcee4be981d2051cdfe45bb85d22_gistfile1.ps1
$ipath = "C:\PATH_TO_THUMBNAILS" $images = gci -Path $ipath $jpgBytes = $null foreach ($image in $images) { $jpgBytes = $null $jpgBytes = [byte[]]$jpg = Get-Content ($image.fullName) -encoding byte set-aduser -id $image.BaseName -replace @{thumbnailPhoto = $jpgBytes} }
PowerShellCorpus/GithubGist/BlueManiac_8e989e6defee486ec560_raw_764371d700c32164843f3cb7d88c809e737d7aec_Restore%20database%20backup%20to%20localdb.ps1
BlueManiac_8e989e6defee486ec560_raw_764371d700c32164843f3cb7d88c809e737d7aec_Restore%20database%20backup%20to%20localdb.ps1
$backupFilePath = "..." $backupDataName = "..." $backupLogName = "..." $databaseInstanceName = "v11.0" $databaseName = '...' $databaseFolderLocation = "C:\Databases" $databaseFileName = "${databaseName}" $tempInstanceName = "temp" $tempDatabaseName = "temp" sqllocaldb create $tempInstanceName -s # C...
PowerShellCorpus/GithubGist/jeremybeavon_1872f1ffc39f2944c6c0_raw_231480aa5a924ff03e02817870df9ee4e522988e_join-object.ps1
jeremybeavon_1872f1ffc39f2944c6c0_raw_231480aa5a924ff03e02817870df9ee4e522988e_join-object.ps1
function AddItemProperties($item, $properties, $output) { if($item -ne $null) { foreach($property in $properties) { $propertyHash =$property -as [hashtable] if($propertyHash -ne $null) { $hashName=$propertyHash["name"] -as [string] ...
PowerShellCorpus/GithubGist/gschizas_4958672_raw_2d6e656024dadc473400fd0a044ad0c8881b7f72_FixVirtualNetworkAdapters.ps1
gschizas_4958672_raw_2d6e656024dadc473400fd0a044ad0c8881b7f72_FixVirtualNetworkAdapters.ps1
# see http://msdn2.microsoft.com/en-us/library/bb201634.aspx # # *NdisDeviceType # # The type of the device. The default value is zero, which indicates a standard # networking device that connects to a network. # # Set *NdisDeviceType to NDIS_DEVICE_TYPE_ENDPOINT (1) if this device is an # endpoint device and i...
PowerShellCorpus/GithubGist/rberrelleza_5870412_raw_25c3965e00ee9a09e0fe6e257ae6fef0655e4e7f_add-users.ps1
rberrelleza_5870412_raw_25c3965e00ee9a09e0fe6e257ae6fef0655e4e7f_add-users.ps1
$domain = (get-addomain).distinguishedname $location = "OU=Engineering,$domain" $domain_email = 'yourdomain.com' $i = 0 Get-Content .\names.csv.txt | ForEach { $i++ $names = $_.Split() $first = $names[0] $last = $names[1] $username = "$first" + "." + "$last" $email = "$username" + $domain_email ...
PowerShellCorpus/GithubGist/janegilring_5736378_raw_76b29cbf20afa01868683d6ac3fa9541a228247a_2013SGEvent6BeginnerSample.ps1
janegilring_5736378_raw_76b29cbf20afa01868683d6ac3fa9541a228247a_2013SGEvent6BeginnerSample.ps1
# Requires -Version 3.0   <# .SYNOPSIS     This script is used to perform basic configuration tasks on one or many Server 2012 core installations. .DESCRIPTION     New-CoreVMConfig is a script that will import a list of MAC addresses located at C:\Mac.txt by default and then query the DHCP server using the DhcpSe...
PowerShellCorpus/GithubGist/mnzk_8893975_raw_8dd4c763572d3534b7666caaf2cb5d0639a65789_method_pipeline.ps1
mnzk_8893975_raw_8dd4c763572d3534b7666caaf2cb5d0639a65789_method_pipeline.ps1
# 追加したメソッドをパイプラインで使いたい $foo = "abc" | Add-Member ScriptMethod Repeat{ param($n) $this * $n } -PassThru #Helper で対応 filter Invoke-Method($method){ $method.Invoke($_) } Set-Alias im Invoke-Method 5 | im $foo.Repeat #=> abcabcabcabcabc
PowerShellCorpus/GithubGist/zhujo01_be1cc2995ed228a4280e_raw_435c859f5493b22d530be00e9ad6dbe725ba7633_openstack-amazon.ps1
zhujo01_be1cc2995ed228a4280e_raw_435c859f5493b22d530be00e9ad6dbe725ba7633_openstack-amazon.ps1
######################################################################## # Openstack Bootstrapping Script # Supported OS: # - Windows 2008 Server R2 SP1 (TESTED) # - Windows 2008 Server (TO BE TESTED) # - Windows 2012 Server (TO BE TESTED) # Image Transformation Target Cloud # - Amazon EC2 # # ...
PowerShellCorpus/GithubGist/janikvonrotz_7823549_raw_ad7a17f08a8825c93a5fb28146c14b49d0f23a8a_Write-ProgressExample.ps1
janikvonrotz_7823549_raw_ad7a17f08a8825c93a5fb28146c14b49d0f23a8a_Write-ProgressExample.ps1
Write-Progress -Activity "Update settings" -status $($Mailbox.Name) -percentComplete ([Int32](([Array]::IndexOf($Mailboxes, $Mailbox)/($Mailboxes.count))*100))
PowerShellCorpus/GithubGist/taddev_3962920_raw_8f9f7db56879811aef2fcb524ce11e9cb9e7a37c_AddCert.ps1
taddev_3962920_raw_8f9f7db56879811aef2fcb524ce11e9cb9e7a37c_AddCert.ps1
# # Author: Tad DeVries # Email: taddevries@gmail.com # FileName: AddCert.ps1 # # Description: Allow a simple method to sign code. # # Copyright (C) 2010 Tad DeVries # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published ...
PowerShellCorpus/GithubGist/pkskelly_7e814b634f18b652f1e2_raw_f3b429481f12fa280e657458b59ed3f6f0a9de6d_RemoveSiteOrphans.ps1
pkskelly_7e814b634f18b652f1e2_raw_f3b429481f12fa280e657458b59ed3f6f0a9de6d_RemoveSiteOrphans.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue" cls Set-Alias -Name stsadm -Value $env:CommonProgramFiles”\Microsoft Shared\Web Server Extensions\15\BIN\STSADM.EXE” function RemoveOrphanedSites([string]$WebAppUrl, [switch]$ReportOnly) { $configDB = Get-SPDatabase | where {$_.type...
PowerShellCorpus/GithubGist/bmccormack_1877128_raw_89090b996f9303acec5586f0340eca57f655e67c_churnQueue.ps1
bmccormack_1877128_raw_89090b996f9303acec5586f0340eca57f655e67c_churnQueue.ps1
function get-queueLength(){ try { $s = (New-Object net.webclient).DownloadString('http://localhost:56785/stats.json') } catch { return "queue length unavailable" } $queueLength = $s -split (',') | foreach{if ($_ | select-string "queueLength" -quiet){ ($_ -split ":")[1]}} return $queueLength ...
PowerShellCorpus/GithubGist/roberto-reale_c5db18c5d912e3802461_raw_25dfa13bd41cf2e48437fe7f82104672a1fa4a59_ps_ping_host_list.ps1
roberto-reale_c5db18c5d912e3802461_raw_25dfa13bd41cf2e48437fe7f82104672a1fa4a59_ps_ping_host_list.ps1
# # ping-host-list # # ping a list of hosts # $Host_List_Path = ".\hostlist.txt" # ping a single host Function Ping-Host { param($InputObject = $null) BEGIN {$status = $False} PROCESS { $processObject = $(if ($InputObject) {$InputObject} else {$_}) if( (Test-Connection $processObjec...
PowerShellCorpus/GithubGist/tkmtmkt_2326853_raw_322be0e5fc52c9d4fc332129e7eabc44137a1131_gistfile1.ps1
tkmtmkt_2326853_raw_322be0e5fc52c9d4fc332129e7eabc44137a1131_gistfile1.ps1
Get-Credential | %{ $user = $_.UserName $pass = ConvertFrom-SecureString $_.Password @" <# .SYNOPSIS command with credential #> `$user = "$user" `$pass = ConvertTo-SecureString "$pass" `$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList `$user,`$pass `$cmd = "cmd" ...
PowerShellCorpus/GithubGist/racingcow_30b01c5cac47fa0e2f5e_raw_e3e4f7221b26467b8c3aaebfc39d2065148eae96_devmachine.ps1
racingcow_30b01c5cac47fa0e2f5e_raw_e3e4f7221b26467b8c3aaebfc39d2065148eae96_devmachine.ps1
############################################################ # Join domain ############################################################ #Rename-Computer -NewName devmachine -LocalCredential admin #Add-Computer -DomainName CT -Credential CT\dmiller #########################################################...
PowerShellCorpus/GithubGist/schlarpc_02cf9a2543f7f1df596b_raw_753b584b0b7b333b9e7191577c72c07a7d6ee846_Microsoft.PowerShell_profile.ps1
schlarpc_02cf9a2543f7f1df596b_raw_753b584b0b7b333b9e7191577c72c07a7d6ee846_Microsoft.PowerShell_profile.ps1
(Get-Host).UI.RawUI.WindowTitle = "Windows PowerShell" function Get-DirAlias ([string]$loc) { return $loc.Replace($env:homedrive + $env:homepath, "~") } function prompt { Write-Host "$env:username@$env:computername" -NoNewLine -ForegroundColor Green Write-Host ":" -NoNewLine Write-Host "$(Get...
PowerShellCorpus/GithubGist/aflyen_10836851_raw_322681446cff7322b57be2fd77feb8ba9b59a9a1_AutoFollowSitesInSharePoint2013.ps1
aflyen_10836851_raw_322681446cff7322b57be2fd77feb8ba9b59a9a1_AutoFollowSitesInSharePoint2013.ps1
# Get UserProfile Manager $site = Get-SPSite -Limit 1 $serviceContext = Get-SPServiceContext($site) $profileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) $profiles = $profileManager.GetEnumerator() # Iterates through all the user profiles foreach ($profile in $profiles)...
PowerShellCorpus/GithubGist/jrothmanshore_2346495_raw_0ffc6eb0fb4e669247adde3f858e7a92e48ee356_gistfile1.ps1
jrothmanshore_2346495_raw_0ffc6eb0fb4e669247adde3f858e7a92e48ee356_gistfile1.ps1
# param( [string] $command = $(throw "command is required. example .\memdata.ps1 ""get SOMEKEYNAME""") ) # function readResponse($stream) { $encoding = new-object System.Text.AsciiEncoding $buffer = new-object System.Byte[] 1024 while ($stream.DataAvailable) { $read = $stream.Read($buffer, 0, 10...
PowerShellCorpus/GithubGist/turp_4007485_raw_3fd222e7e3a156a8ad3bda1cc724a10ca3951b53_downloadBuildVideos.ps1
turp_4007485_raw_3fd222e7e3a156a8ad3bda1cc724a10ca3951b53_downloadBuildVideos.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 $a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2012/RS...
PowerShellCorpus/GithubGist/egomesbrandao_952260_raw_833defc7c1acee47d6e85f557696df5fe1f930e3_RunGallioTestsPS.ps1
egomesbrandao_952260_raw_833defc7c1acee47d6e85f557696df5fe1f930e3_RunGallioTestsPS.ps1
if ( (Get-PSSnapin -Name Gallio -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Gallio } $result = Run-Gallio "c:\[CAMINHO]\Test.dll" -ReportDirectory "c:[CAMINHO]\TestReports" -ReportTypes "Html" -ShowReports -Filter Type:@args[0] if ($result.Statistics.FailedCount -gt 0) { Write-Warning "So...
PowerShellCorpus/GithubGist/jangeador_b9f46f113fc48c56bddb_raw_dc88acab9237d30842ca2d3244b68af74e4d4dbf_LimitSentMessages.ps1
jangeador_b9f46f113fc48c56bddb_raw_dc88acab9237d30842ca2d3244b68af74e4d4dbf_LimitSentMessages.ps1
# To create a new policy where the users can send to 30 recipients a day # and no more than 1 message per minute, you would use this command: New-ThrottlingPolicy -Name LimitMessagesSent -RecipientRateLimit 30 -MessageRateLimit 1 # To assign it to a user, use this command: Set-Mailbox -Identity user_alias -Throt...
PowerShellCorpus/GithubGist/jmoberly_6394984_raw_55bf27f701dcd5f1afe725004d1371a649f92a87_ProgressBarExample.ps1
jmoberly_6394984_raw_55bf27f701dcd5f1afe725004d1371a649f92a87_ProgressBarExample.ps1
$thingsArray = 0,1,2,3,4,5,6,7,8,9 $i = 0 foreach($thing in $thingsArray) { Start-Sleep -s 1 $i++ $complete = $i / $thingsArray.Length * 100 Write-Progress -activity "Retrieving things..." -status "Percent found: " -PercentComplete $complete }
PowerShellCorpus/GithubGist/sneal_de23df76382708b132ce_raw_553835e9d6c660ad820a7c1f340e17b1b5dce471_instal-chef.ps1
sneal_de23df76382708b132ce_raw_553835e9d6c660ad820a7c1f340e17b1b5dce471_instal-chef.ps1
$download_url = 'https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-client-11.12.4-1.windows.msi' (New-Object System.Net.WebClient).DownloadFile($download_url, 'C:\\Windows\\Temp\\chef.msi') Start-Process 'msiexec' -ArgumentList '/qb /i C:\\Windows\\Temp\\chef.msi' -NoNewWindow -Wait
PowerShellCorpus/GithubGist/mopsusm_9dfd3972f3670d33752c_raw_e9506f21f4098558c2e6454621de4ac6ebe8c9d7_BasicBox.ps1
mopsusm_9dfd3972f3670d33752c_raw_e9506f21f4098558c2e6454621de4ac6ebe8c9d7_BasicBox.ps1
# To Start http://boxstarter.org/package/url?Raw-Gist-URL cinst chocolatey cinst boxstarter #try { # Install AV cinst MicrosoftSecurityEssentials # Always install Updates Install-WindowsUpdate -AcceptEula if (Test-PendingReboot) { Invoke-Reboot } # Windows 8 options #...
PowerShellCorpus/GithubGist/Sakuramochi_5245292_raw_36d46b55be3697896a3380b7b06ea607912ceef0_excel_macro_run.ps1
Sakuramochi_5245292_raw_36d46b55be3697896a3380b7b06ea607912ceef0_excel_macro_run.ps1
############################################################ # 動作未確認 動くかわからん # this script do not work # 手元にexcelないからテストできませんでした。 ############################################################ # excelのマクロを実行するスクリプト # 言語 # Windows Powershell # 書式 # excel_macro_run # オプション # $file_name_A excelファイルA # $she...
PowerShellCorpus/GithubGist/josheinstein_3171994_raw_912c78b3a99799127151bf8f63e9b2139921f3ab_expand-numbers.ps1
josheinstein_3171994_raw_912c78b3a99799127151bf8f63e9b2139921f3ab_expand-numbers.ps1
Set-Location ~\Dropbox\Work\Journal\201207 Import-CSV numbers.csv -Header From,To | %{ if ($_.From -match '^\d+$') { [Int64]$From = $_.From [Int64]$To = $(if ($_.To) { $_.To } else { $From }) [Int64]$i = $From while ($i -le $To) { Write-Output $i ...
PowerShellCorpus/GithubGist/taddev_3962957_raw_250a9853155415f9afa7b3074abe14b641ab2d2a_InputTest.ps1
taddev_3962957_raw_250a9853155415f9afa7b3074abe14b641ab2d2a_InputTest.ps1
param( [switch]$parent, [switch]$child, [switch]$help, [string]$template ); function displayHelp() { echo "Input is piped in from the command line.`nThis script will process some stuff"; echo "Parameters:`n"; echo "`t-child`tProcess the child nodes"; echo "`t-parent`tProcess the parent nodes"; ...
PowerShellCorpus/GithubGist/MikaelSmith_d885c72dd87e61e3f969_raw_bd01c6502e6699185ff0886afffc52b58695c7be_build_cfacter_win.ps1
MikaelSmith_d885c72dd87e61e3f969_raw_bd01c6502e6699185ff0886afffc52b58695c7be_build_cfacter_win.ps1
# Starting from a base Windows Server 2008r2 or 2012r2 installation, install required tools, setup the PATH, and download and build software. # This script can be run directly from the web using "iex ((new-object net.webclient).DownloadString('<url_to_raw>'))" ### Configuration ## Setup the working directory $sou...
PowerShellCorpus/GithubGist/sunnyc7_9278563_raw_85c7faf65d3d2d460794af4bfe8550c4138a69fe_roger-params.ps1
sunnyc7_9278563_raw_85c7faf65d3d2d460794af4bfe8550c4138a69fe_roger-params.ps1
$s = New-PSSession -ComputerName servermaame #I am using PID 0,4, assigned to System and Idle for testing, as they are always available. $pid1 = 4 $processId = 0 # CASE: Remote session variable, but no argument list to pass. # This wont work, because there is no argument list assignment to pass to the scriptbl...
PowerShellCorpus/GithubGist/rhysgodfrey_0285a5e816e5f64fdfca_raw_6bf8eed7a93363798d4dbc1042a0b5f36a4785c5_aws-quick-start-demo-prerequisites.ps1
rhysgodfrey_0285a5e816e5f64fdfca_raw_6bf8eed7a93363798d4dbc1042a0b5f36a4785c5_aws-quick-start-demo-prerequisites.ps1
Set-AWSCredentials -AccessKey ACCESS-KEY -SecretKey SECRET-KEY -StoreAs AWSQuickStartDemo Initialize-AWSDefaults -ProfileName AWSQuickStartDemo -Region eu-west-1
PowerShellCorpus/GithubGist/jgable_884312_raw_16747896e8cb2de9a789fbc889d31f4ab7e644e0_Gist4u2.ps1
jgable_884312_raw_16747896e8cb2de9a789fbc889d31f4ab7e644e0_Gist4u2.ps1
# Serializer loader $extAssembly = [Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") $serializer = New-Object System.Web.Script.Serialization.JavaScriptSerializer # Url's formatted $gistUserListUrlForm = "http://gist.github.com/api/v1/json/gists/{0}"; $gistInfoUrlForm = "http://gist.github....
PowerShellCorpus/GithubGist/Gunslap_223ada0870c3d5ce89c9_raw_33eae28a20dbb4b7407eac39baf8b344715c3afe_AccountDisablerFunction.ps1
Gunslap_223ada0870c3d5ce89c9_raw_33eae28a20dbb4b7407eac39baf8b344715c3afe_AccountDisablerFunction.ps1
<# .SYNOPSIS This function disables accounts that are older than a certain threshhold. .DESCRIPTION Searches active directory for users based on an inputted searchbase for users that haven't logged in since a certain threshhold or haven't logged in ever and were created before that threshhold and disables them an...
PowerShellCorpus/GithubGist/ctrlbold_63e3d97042f7185b2bc7_raw_373b094c9ae9a8b3f3bb75279a7afbfc949e3b82_advanced-datatable.ps1
ctrlbold_63e3d97042f7185b2bc7_raw_373b094c9ae9a8b3f3bb75279a7afbfc949e3b82_advanced-datatable.ps1
# Create Basic Datatable $datatable = New-Object System.Data.Datatable [void]$datatable.Columns.Add("name") [void]$datatable.Columns.Add("directory") [void]$datatable.Columns.Add("bytes", [double]) # Add data [void]$datatable.Rows.Add("locate","C:",1.0) [void]$datatable.Rows.Add("Backup","C:\locate",1.0) [vo...
PowerShellCorpus/GithubGist/dillo_5571126_raw_513632d3e6537d002908764b2342c880115360fb_gistfile1.ps1
dillo_5571126_raw_513632d3e6537d002908764b2342c880115360fb_gistfile1.ps1
#!/bin/sh # # unicorn - this script starts and stops the unicorn processes for Rentals.com # # chkconfig: - 85 15 # description: Unicorn init script # config: /var/www/rl/shared/system/unicorn.rb # pidfile: /var/www/rl/shared/pids/unicorn.pid # Source function li...
PowerShellCorpus/GithubGist/janikvonrotz_7806446_raw_c6f666d4e24c6d856db4aa16a587e04532965003_GetSPFarmBuildVersion.ps1
janikvonrotz_7806446_raw_c6f666d4e24c6d856db4aa16a587e04532965003_GetSPFarmBuildVersion.ps1
get-spfarm | select BuildVersion
PowerShellCorpus/GithubGist/ziembor_5267304_raw_f0a630eb549db60b387e882fa2b81750f2af99ef_get-ADUsersWithManagerGroupMemberShips.ps1
ziembor_5267304_raw_f0a630eb549db60b387e882fa2b81750f2af99ef_get-ADUsersWithManagerGroupMemberShips.ps1
$users = get-ADUser -Filter * -Properties manager | where {$_.manager -ne $null} foreach ($user in $users) { $userSAM = $user.SamAccountName $plik = "info_$userSAM.txt" $user | out-file -Append $plik Get-ADPrincipalGroupMembership $user.DistinguishedName | out-file -Append $plik }
PowerShellCorpus/GithubGist/xoner_3891317_raw_aed0d2c2b809d3221d82bdc86095a8206349307a_ChangeExtension.ps1
xoner_3891317_raw_aed0d2c2b809d3221d82bdc86095a8206349307a_ChangeExtension.ps1
foreach ($itFile in ls *.markdown) { if ($itFile -match '(.*)\.(\w+)') { Write-Host 'Renaming ' $itFile $destFile = $Matches[1] + '.md' mv $itFile $destFile } }
PowerShellCorpus/GithubGist/rhb21_6508805_raw_c8b85a88e9914e24b05d57b2ed9ed9d7257d3816_Create-PluginInstaller.ps1
rhb21_6508805_raw_c8b85a88e9914e24b05d57b2ed9ed9d7257d3816_Create-PluginInstaller.ps1
############################ # # Expected plugin directory structure: # $pluginDir # |-<org_0> # ||-<plugin_0> # |||-<plugin_files> # ||-<plugin_1> # |||-<plugin_files> # ||-<plugin_2> # |||-<plugin_files> # |-<org_1> # ||-<plugin_0> # |||-<plugin_files> # etc. # # other files belo...
PowerShellCorpus/GithubGist/lamw_9928202_raw_c15c78de20e0dbf7a3b5a6beeff992bb829a4f49_gistfile1.ps1
lamw_9928202_raw_c15c78de20e0dbf7a3b5a6beeff992bb829a4f49_gistfile1.ps1
$json = @" {"A": {"property1": "value1", "property2": "value2"}, "B": {"property1": "value3", "property2": "value4"}} "@ $parsed = $json | ConvertFrom-Json foreach ($line in $parsed | Get-Member) { echo $parsed.$($line.Name).property1 echo $parsed.$($line.Name).property2 }
PowerShellCorpus/GithubGist/wormeyman_c180a73f221469fc88e2_raw_5c9a5949fb8e7e5fce4f821ccecb5e58552a8cd4_windowsLiveStreamer.ps1
wormeyman_c180a73f221469fc88e2_raw_5c9a5949fb8e7e5fce4f821ccecb5e58552a8cd4_windowsLiveStreamer.ps1
# livestreamer --verbose-player --player "'C:\Program Files (x86)\VideoLAN\VLC\vlc.exe' --file-caching=5000" --default-stream best THEURL # PowerShell -ExecutionPolicy Bypass -File windowsLiveStreamer.ps1 $video = Read-Host 'What is the video url?' # Update LiveStream Write-Host -ForegroundColor Green "Updating l...
PowerShellCorpus/GithubGist/stephengodbold_5279081_raw_e03dee00f841c927b636342e39d41ed1b437a19f_Install-BuildMonitor.ps1
stephengodbold_5279081_raw_e03dee00f841c927b636342e39d41ed1b437a19f_Install-BuildMonitor.ps1
param( [parameter()] [string] $repositoryRoot, [parameter()] [string] $installRoot = $env:ProgramFiles ) function Get-MsBuildPath { $registryLocation = 'HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0\' $registryEntry = Get-ItemProperty $registryLocation -Name 'M...
PowerShellCorpus/GithubGist/ao-zkn_4ef4432bf8cc833f36fa_raw_defae0a87ae49271d7541317142ffbfa50051e8e_Select-ExcelByWorkSheet.ps1
ao-zkn_4ef4432bf8cc833f36fa_raw_defae0a87ae49271d7541317142ffbfa50051e8e_Select-ExcelByWorkSheet.ps1
# ------------------------------------------------------------------ # Excelファイルをシート単位で検索 # 関数名:Select-ExcelByWorkSheet # 引数 :ExcelFilePath 検索対象のExcelファイル # :Target 検索対象項目 # 戻り値:検索結果 # ------------------------------------------------------------------ function Select-ExcelByWorkSheet([String]$ExcelFilePath, [Stri...
PowerShellCorpus/GithubGist/agross_6178123_raw_77962a7c5e45ead40a8e9e841322becf504ec225_deploy.ps1
agross_6178123_raw_77962a7c5e45ead40a8e9e841322becf504ec225_deploy.ps1
$ErrorActionPreference = 'Stop' $scriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition Import-Module "$scriptPath\tools\deployment-tools" Import-Module "$scriptPath\bin\NServiceBus.PowerShell.dll" $permissions = @{ '' = @{ "FullControl" = @( $(ConvertTo-UserName([System.Security.Principal.Wel...
PowerShellCorpus/GithubGist/giseongeom_fe2b0d90409b484dc15b_raw_2b51a90e43158ae52dff17a909bdff76ca35fb38_get-koalra-files.ps1
giseongeom_fe2b0d90409b484dc15b_raw_2b51a90e43158ae52dff17a909bdff76ca35fb38_get-koalra-files.ps1
# get-koalra-files.ps1 # Retrieve .pptx files from Koalra Server # # Author : GiSeong Eom <jurist@kldp.org> # Created: 2012-06-22 # Updated: 2013-03-16 # ChangeLog # v0.2 Updated for SC2012 LAB files # v0.1 Originally written # Global Variables $ErrorActionPreference = "si...
PowerShellCorpus/GithubGist/ecampidoglio_3905035_raw_498bcfbc8d6fe01fc03ec098319a0a1a22ca136e_Import-PSSnapin.ps1
ecampidoglio_3905035_raw_498bcfbc8d6fe01fc03ec098319a0a1a22ca136e_Import-PSSnapin.ps1
function Import-PSSnapin { <# .Synopsis Adds a Windows PowerShell snap-in with the specified name to the current session. This cmdlet will not throw an exception if the specified snap-in is already present in the session. .Description Helper function to safely add a Windows PowerShell snap-in with the...
PowerShellCorpus/GithubGist/usami-k_1686889_raw_8153e633e271d4d793342f782b1ba59782f5d4ce_powershell_history.ps1
usami-k_1686889_raw_8153e633e271d4d793342f782b1ba59782f5d4ce_powershell_history.ps1
# Add this code to your PowerShell Profile (see $Profile) # history file name $HistoryFile = Join-Path (Split-Path $Profile -Parent) history.csv # save history on exit Register-EngineEvent PowerShell.Exiting -SupportEvent -Action { Get-History -Count $MaximumHistoryCount | Export-Csv $HistoryFile } # load...
PowerShellCorpus/GithubGist/obscuresec_b6c97b423fedc4500c10_raw_3a0eedb1dcda946f015486737c1d45315be63517_gistfile1.ps1
obscuresec_b6c97b423fedc4500c10_raw_3a0eedb1dcda946f015486737c1d45315be63517_gistfile1.ps1
$LdapFilter = #Query Goes Here ([adsisearcher]"$LdapFilter").Findall()
PowerShellCorpus/GithubGist/sunnyone_7875591_raw_f58a560a57b9786668577a96cd9aa1fd42ab9cff_ShowStackDump.ps1
sunnyone_7875591_raw_f58a560a57b9786668577a96cd9aa1fd42ab9cff_ShowStackDump.ps1
param($Dump) New-DbgSession -dump $Dump -sos Invoke-DbgCommand "~*e !clrstack" Exit-DbgSession
PowerShellCorpus/GithubGist/ao-zkn_c54d71f4d0873faffad3_raw_5f3ad9c9789882ff0952de25d99afa10cd99c44f_Copy-Folder.ps1
ao-zkn_c54d71f4d0873faffad3_raw_5f3ad9c9789882ff0952de25d99afa10cd99c44f_Copy-Folder.ps1
# ------------------------------------------------------------------ # コピー元のフォルダ構成をコピー先にコピーする # 関数名:Copy-Folder # 引数  :CopyFolderPath コピー元のフォルダフルパス # DestFolderPath コピー先のフォルダフルパス # 戻り値:なし # ------------------------------------------------------------------ function Copy-Folder([String]$CopyFolderPath, [String]$...
PowerShellCorpus/GithubGist/yetanotherchris_0f1d763e6d539fc61857_raw_99d50cc315a77a5954c690f6eca35472822d1131_AppveyorChrome.ps1
yetanotherchris_0f1d763e6d539fc61857_raw_99d50cc315a77a5954c690f6eca35472822d1131_AppveyorChrome.ps1
# Project->Settings->Environment->Install script iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) cinst GoogleChrome cinst gb.MongoDB
PowerShellCorpus/GithubGist/guitarrapc_ae3d60e9517587abda71_raw_37af628a58d96206c9728d887970e3653d3a44b9_SetLCM.ps1
guitarrapc_ae3d60e9517587abda71_raw_37af628a58d96206c9728d887970e3653d3a44b9_SetLCM.ps1
Set-DscLocalConfigurationManager -Path test
PowerShellCorpus/GithubGist/Haemoglobin_2205505_raw_dfe1a6ac784f41a848bed2a3f94935e4bba35875_add-source-headers.ps1
Haemoglobin_2205505_raw_dfe1a6ac784f41a848bed2a3f94935e4bba35875_add-source-headers.ps1
#requires -version 2 <# #> param( [Parameter(Mandatory = $true)] [string] $sourceRoot, [Parameter(Mandatory = $true)] [string] $versionNumber ) function CorrectPathBackslash { param([string] $path) if (![String]::IsNullOrEmpty($path)) { if (!$path.EndsWith("\")) { $pa...
PowerShellCorpus/GithubGist/zippy1981_1586729_raw_7e46e3e35428757ce9a9a88bbdd42662ea6e3f85_integerDivision.test.ps1
zippy1981_1586729_raw_7e46e3e35428757ce9a9a88bbdd42662ea6e3f85_integerDivision.test.ps1
<# In which I prove that that the terser [int][Math]::Floor($a/$b) gives the same results as the technet recommended [Math]::Floor([int]$a / [int]$b) Said technet recomendation is available at: http://technet.microsoft.com/en-us/library/ee176879.aspx One extra cast is probably slower too. #> 1.. 1000 | Fo...
PowerShellCorpus/GithubGist/bedecarroll_7405639_raw_e8d779cbdbb9167d25ed9066438471091a2d7ae0_gistfile1.ps1
bedecarroll_7405639_raw_e8d779cbdbb9167d25ed9066438471091a2d7ae0_gistfile1.ps1
Get-CimInstance Win32_WinSAT | Format-List @{Label="Base Score";Expression={$_.WinSPRLevel}},@{Label="Processor";Expression={$_.CPUScore}},@{Label="Memory (RAM)";Expression={$_.MemoryScore}},@{Label="Graphics";Expression={$_.GraphicsScore}},@{Label="Gaming graphics";Expression={$_.D3DScore}},@{Label="Primary hard disk"...
PowerShellCorpus/GithubGist/RhysC_850863_raw_8a732b72cf81e8d53d5171259e6fe4a2e95dc653_GetProjectSummarys.ps1
RhysC_850863_raw_8a732b72cf81e8d53d5171259e6fe4a2e95dc653_GetProjectSummarys.ps1
$projectSummarys = @{} Get-ChildItem -exclude '*Test*' -Recurse -Include *.csproj | Where-Object {$_.Attributes -ne "Directory"} | %{ $filename = $_.FullName $proj = [xml](get-Content $filename); $projectSummarys[$filename] = ($proj.Project.PropertyGroup)|select -Skip 1 -First 1 | select WarningLev...
PowerShellCorpus/GithubGist/randyburden_7666678_raw_3a808ebfee87fc360319c7c2a324aced6a7378ac_install.ps1
randyburden_7666678_raw_3a808ebfee87fc360319c7c2a324aced6a7378ac_install.ps1
param($installPath, $toolsPath, $package, $project) # open splash page on package install # don't open if it is installed as a dependency # attribution: Modified from: https://github.com/JamesNK/Newtonsoft.Json/blob/master/Build/install.ps1 try { $url = "http://randyburden.com/Slapper.AutoMapper/" $packa...
PowerShellCorpus/GithubGist/aciniform_4998671_raw_4fa6dfa7984ca9428fe1f05d83e9994fd07df784_Send-PwdExpirationNotice.ps1
aciniform_4998671_raw_4fa6dfa7984ca9428fe1f05d83e9994fd07df784_Send-PwdExpirationNotice.ps1
[CmdletBinding()] param( [switch] $WhatIf, [switch] $ReportOnly ) ############################################################################### # Configuration Parameters # #########################################################...
PowerShellCorpus/GithubGist/seriema_7431598_raw_6e8b963898f81549efb85e2656c7ab3d6d40b8a4_boxstarter.ps1
seriema_7431598_raw_6e8b963898f81549efb85e2656c7ab3d6d40b8a4_boxstarter.ps1
try { # Dev cinst VisualStudio2013Ultimate -InstallArguments "/Features:'Blend WebTools'" cinst VS2013.1 cinst VS2013.2 cinst VS2013.3 cinst visualstudio2013-webessentials.vsix cinst resharper cinst git cinst githubforwindows cinst fiddler4 cinst sysinternals cinst windbg cinst dotPeek # Tools cinst cc...
PowerShellCorpus/GithubGist/sclarson_1a2deecc8ca4592e1ef1_raw_45958421ee5155e221bbe75e11821e2a36ffe88b_sensitiveCd.ps1
sclarson_1a2deecc8ca4592e1ef1_raw_45958421ee5155e221bbe75e11821e2a36ffe88b_sensitiveCd.ps1
function GetCaseSensitivePath{ param($pathName) $pathExists = Test-Path($pathName) if (-Not $pathExists){ return $pathName } $directoryInfo = New-Object IO.DirectoryInfo($pathName) if ($directoryInfo.Parent -ne $null){ $parentPath = GetCaseSensitivePath($directory...
PowerShellCorpus/GithubGist/mgreenegit_891dddc6de8d7be5dfd2_raw_561ca66c7f86894dca8a0e54687eb1f1b1afe2b0_HydrateAllPublicResKitodulesOnPOCPullServer.ps1
mgreenegit_891dddc6de8d7be5dfd2_raw_561ca66c7f86894dca8a0e54687eb1f1b1afe2b0_HydrateAllPublicResKitodulesOnPOCPullServer.ps1
$AllModules = 'https://gallery.technet.microsoft.com/scriptcenter/DSC-Resource-Kit-All-c449312d/file/131371/1/DSC%20Resource%20Kit%20Wave%209%2012172014.zip' $Folder = 'C:\AllModules' $PullServerModules = 'C:\DscWebService\Modules' if (!(Test-Path "$Folder\Archives")) {mkdir "$Folder\Archives" | out-null} Invoke-We...