full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/GithubGist/knjname_8472329_raw_ca6ce9b79866970c5955d8784563682391847ef5_testIfSupportingClosure.ps1
knjname_8472329_raw_ca6ce9b79866970c5955d8784563682391847ef5_testIfSupportingClosure.ps1
$givenValue = 10 function testIfSupportingClosure(){ $givenValue = 4 { $givenValue = $givenValue + 1 echo "The givenValue is ${givenValue}." } } $closureA = testIfSupportingClosure $closureA.invoke() # The givenValue is 11. $closureA.invoke() # The givenValue is 11. $closu...
PowerShellCorpus/GithubGist/jstangroome_6189660_raw_dc78e4e52a8d58bfd49b7adac303008f5f0bbbf0_ConvertFrom-IISW3CLog.ps1
jstangroome_6189660_raw_dc78e4e52a8d58bfd49b7adac303008f5f0bbbf0_ConvertFrom-IISW3CLog.ps1
function ConvertFrom-IISW3CLog { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [Alias('PSPath')] [string[]] $Path ) process { foreach ($SinglePath in $Path) { $FieldNames = $null ...
PowerShellCorpus/GithubGist/Iristyle_1178601_raw_481599615c627cd11f73686d2f6fdec53b25fc56_Microsoft.PowerShell_profile.ps1
Iristyle_1178601_raw_481599615c627cd11f73686d2f6fdec53b25fc56_Microsoft.PowerShell_profile.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) # Load posh-hg module from current directory #Import-Module .\posh-hg # If module is installed in a default location ($env:PSModulePath), # use this instead (see about_Modules for more information): Import-Module posh-hg # Set up a ...
PowerShellCorpus/GithubGist/pepoluan_5856121_raw_efb845413f57cecdc9242c0c0f103449f937faad_GetU.ps1
pepoluan_5856121_raw_efb845413f57cecdc9242c0c0f103449f937faad_GetU.ps1
Function GetU() { param( $usr, $Order, [switch]$Silent ) $EssentialAttributes = @( "EmployeeID" "Email" "MobilePhone" "Manager" ) # Specifying "-Order" overrides everything else If ($Order -ne $null) { $usr...
PowerShellCorpus/GithubGist/amirrajan_3190670_raw_0db10b74e2cf1f0cb556ee9789e64938cb2327eb_gistfile1.ps1
amirrajan_3190670_raw_0db10b74e2cf1f0cb556ee9789e64938cb2327eb_gistfile1.ps1
$foo = @{ Message = "This is a pre-recorded message" } $foo.say = { param([string]$message) $speaker = new-object -com SAPI.SpVoice ($speaker.Speak($message, 1)) | out-null } $foo.SayPreRecordedMessage = { . $foo.say $foo.Message } #Then you can run: . $foo.SayPreRecordedMessage #but, we don't really have ...
PowerShellCorpus/GithubGist/robertchong_032da878a91c4dce9353_raw_56008363604924ec23206fab08ec7d6e752132c7_Get-PKICertificates.ps1
robertchong_032da878a91c4dce9353_raw_56008363604924ec23206fab08ec7d6e752132c7_Get-PKICertificates.ps1
Function Get-PKICertificates { <# .SYNOPSIS Gets all X.509 Certificates on a local or remote computers Source: http://gallery.technet.microsoft.com/scriptcenter/a2a500e5-1dd2-4898-9721-ed677399679c .DESCRIPTION Gets all X.509 Certificates on a local or remote computers that are from T...
PowerShellCorpus/GithubGist/normansolutions_8972413_raw_97727892b011f1afc65b450e0e0fe7e3cefbf50f_DisableRDPonAD.ps1
normansolutions_8972413_raw_97727892b011f1afc65b450e0e0fe7e3cefbf50f_DisableRDPonAD.ps1
Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue Get-QADUser * -OrganizationalUnit "ou=Your Sub-OU,ou=Your OU,dc=Your LDAP,dc=Your LDAP" | ?{$_.TsAllowLogon -ne $true} | Set-QADUser -TsAllowLogon $true
PowerShellCorpus/GithubGist/gravejester_f0673d05068a162de7ad_raw_c4b522d77ea063062539eadb0b4ed0aaef1d42cc_Microsoft.PowerShell_profile.ps1
gravejester_f0673d05068a162de7ad_raw_c4b522d77ea063062539eadb0b4ed0aaef1d42cc_Microsoft.PowerShell_profile.ps1
# PowerShell Profile - Øyvind Kallstad # Last updated: 27.11.2014 # Get the original prompt $originalPrompt = (Get-Item function:prompt).ScriptBlock # define our new custom prompt $customPrompt = { $currentLocaction = $executionContext.SessionState.Path.CurrentLocation.ToString() $host.UI.RawUI.Windo...
PowerShellCorpus/GithubGist/tanaka-takayoshi_8066824_raw_bf804bf48e33c2015a0702f108f584fd80e50c16_Get-SystemPowerStatus.ps1
tanaka-takayoshi_8066824_raw_bf804bf48e33c2015a0702f108f584fd80e50c16_Get-SystemPowerStatus.ps1
$signature = @" [DllImport("kernel32.dll", SetLastError = true)] public static extern Boolean GetSystemPowerStatus(out SystemPowerStatus sps); public struct SystemPowerStatus { public Byte ACLineStatus; public Byte BatteryFlag; public Byte BatteryLifePercent; public Byte Reserved1; public Int32...
PowerShellCorpus/GithubGist/AdamDotCom_364694_raw_d26fdfc4dc38293839bca2d52ba83cd94a27d461_install-git.ps1
AdamDotCom_364694_raw_d26fdfc4dc38293839bca2d52ba83cd94a27d461_install-git.ps1
# Installs git for Windows via PowerShell # # Sample usage: # # Install git: # PS> install-git # # Adam Kahtava - http://adam.kahtava.com/ - MIT Licensed function global:install-git { install-file http://msysgit.googlecode.com/files/Git-1.6.4-preview20090730.exe } function global:install-file([string] $urlPath)...
PowerShellCorpus/GithubGist/jstangroome_7835806_raw_7f3c5bdaeece1c8ea54173af13f256414dd3a2cb_Sort-WSDL.ps1
jstangroome_7835806_raw_7f3c5bdaeece1c8ea54173af13f256414dd3a2cb_Sort-WSDL.ps1
#requires -version 3.0 [CmdletBinding()] param ( [Parameter(Mandatory)] [string] $Path ) function Sort-NodeArray { param ( [System.Xml.XmlNode[]] $SortedNodes ) foreach ($Node in $SortedNodes) { $Node.ParentNode.AppendChild($Node.ParentNode.RemoveChild($N...
PowerShellCorpus/GithubGist/vivainio_be8e7d8a6248fdf97ef2_raw_87e3a3a85f86a0ac493cf101f6c1c4b0460792c5_gistfile1.ps1
vivainio_be8e7d8a6248fdf97ef2_raw_87e3a3a85f86a0ac493cf101f6c1c4b0460792c5_gistfile1.ps1
# edit this by: notepad $PROFILE # assumes you have Github for Windows installed (or just posh-git may be enough?) # Load posh-git example profile . 'C:\Users\villevai\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1' # Set up a simple prompt, adding the git prompt parts inside git repos function...
PowerShellCorpus/GithubGist/ao-zkn_d8e1771b053f94749b5a_raw_f3ded68914520a4464e937cd49eecf262d937fe2_AddNumber-FileNameByCreationTime.ps1
ao-zkn_d8e1771b053f94749b5a_raw_f3ded68914520a4464e937cd49eecf262d937fe2_AddNumber-FileNameByCreationTime.ps1
# ------------------------------------------------------------------ # フォルダ配下のファイル名を作成日時順に連番を付ける # 関数名:AddNumber-FileNameByCreationTime # 引数  :FolderPath 対象フォルダ # :Include 対象拡張子 # :AddType 連番指定[接頭or接尾] (※接頭の場合は「Prefix」、接尾の場合は「Suffix」を指定) # :NumberFormat 0埋め桁数 (※3桁の場合「000」と桁数分0を指定) # 戻り値:なし # --------...
PowerShellCorpus/GithubGist/bohrshaw_5e7b51e999f2d6ca8f6a_raw_24706f51ee11b670cc1e3016c4d56d537fc94c5b_ruby-builder.ps1
bohrshaw_5e7b51e999f2d6ca8f6a_raw_24706f51ee11b670cc1e3016c4d56d537fc94c5b_ruby-builder.ps1
# Build Ruby with Visual Studio on Windows # Refer win32/README.win32 mkdir mswin32 cd mswin32 ../win32/configure.bat --target=i686-mswin32 --prefix=D:/Programs/Ruby21mswin nmake nmake test nmake install
PowerShellCorpus/GithubGist/ktsugita_5559192_raw_c405f3af169c0bc2a2efdf51cec2acafb4801782_gistfile1.ps1
ktsugita_5559192_raw_c405f3af169c0bc2a2efdf51cec2acafb4801782_gistfile1.ps1
$disk = Get-WmiObject -class Win32_LogicalDisk -filter "DeviceID='C:'" Write-Host "Free space on drive C: at $($disk.freespace / $disk.size * 100) percent"
PowerShellCorpus/GithubGist/alexrydzak_6386419_raw_6c1d4884e546a747a3165439fcdb3a905a590d55_hide_metro.ps1
alexrydzak_6386419_raw_6c1d4884e546a747a3165439fcdb3a905a590d55_hide_metro.ps1
# hide_metro.ps1 # sends <Win>+D to minimize Metro on login # save as C:\Users\<Your User>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\hide_metro.ps1 $shell = New-Object -ComObject "Shell.Application" $shell.minimizeall()
PowerShellCorpus/GithubGist/kyam_5575779_raw_3fd1537e119625285c58e739fce531f3a49d5c51_listed_installapps.ps1
kyam_5575779_raw_3fd1537e119625285c58e739fce531f3a49d5c51_listed_installapps.ps1
# Get All Applications with .msi $apps = Get-WmiObject -Query "SELECT * FROM win32_product" foreach ($app in $apps) { Write-Host $app.Name $app.Vendor } # Get Application with .msi selected by name $apps = Get-WmiObject -Query "SELECT * FROM win32_product WHERE name = 'Adobe AIR'" Write-Host $app.Name $app...
PowerShellCorpus/GithubGist/Retro2707_7334955_raw_397ab2a7e60f2dda9ef75c9cdff443ebe396577b_err.ps1
Retro2707_7334955_raw_397ab2a7e60f2dda9ef75c9cdff443ebe396577b_err.ps1
$error[0].Exception.GetType().Fullname #or while in a script. try { # code that causes exception } catch { $_.Exception.GetType().FullName }
PowerShellCorpus/GithubGist/belotn_5664076_raw_113df7c08d119a44b36d42ea085d61ba758f0c0c_generate_chart.ps1
belotn_5664076_raw_113df7c08d119a44b36d42ea085d61ba758f0c0c_generate_chart.ps1
$html ="<html> <head> <!--Load the AJAX API--> <script type=`"text/javascript`" src=`"https://www.google.com/jsapi`"></script> <script type=`"text/javascript`"> // Load the Visualization API and the piechart package. google.load('visualization', '1.0', {'packages':['corechart']}); ...
PowerShellCorpus/GithubGist/gravejester_1290947b5da8dd9e733d_raw_82208a3f7bd0da310b718cf4d71182e014bb92e4_New-MsSqlConnection.ps1
gravejester_1290947b5da8dd9e733d_raw_82208a3f7bd0da310b718cf4d71182e014bb92e4_New-MsSqlConnection.ps1
function New-MsSqlConnection { <# .SYNOPSIS Create a new MSSQL database connection. .DESCRIPTION This function will create a new Microsoft SQL Server database connection and return a database connection object. .EXAMPLE New-MsSqlConnection -Database...
PowerShellCorpus/GithubGist/rgbkrk_7271813_raw_b34cc982bce34094fc5015fb49acf41597b1d106_pyrax_install.ps1
rgbkrk_7271813_raw_b34cc982bce34094fc5015fb49acf41597b1d106_pyrax_install.ps1
## ## NOTE: This script is a walkthrough and may not work if run directly. ## ## If downloaded to run, make sure to set ## ## Set-ExecutionPolicy RemoteSigned ## # Create a downloader via .NET $notwget = New-Object System.Net.WebClient # We'll download and install # - the Python 2.7 64-bit msi # - ez_se...
PowerShellCorpus/GithubGist/aseabridge_2402637_raw_0ed7186782befbcce1fd67256082e0308ef581b9_delte-users.ps1
aseabridge_2402637_raw_0ed7186782befbcce1fd67256082e0308ef581b9_delte-users.ps1
#Configuration $Url = "http://yoursite.com" $Username = "admin" $ApiKey = "yourapikeyxxxxxxxxxxxxxx" $userNamesToDelete = @("adssgdsg", "peterpan", "test") #End Configuration $UserToken =[Convert]::ToBase64String([System.Text.Encoding]::Utf8.GetBytes("${ApiKey}:${Username}")) $webClient = new-object System.Net.WebCli...
PowerShellCorpus/GithubGist/jonschoning_1149265_raw_7f5a60fc896b1b3d3a62d3b4c5a90d304a07761d_Get-SubDirSizes.ps1
jonschoning_1149265_raw_7f5a60fc896b1b3d3a62d3b4c5a90d304a07761d_Get-SubDirSizes.ps1
function Get-SubDirSizes { param([Parameter(Mandatory=$true)] [string] $path) dir $path -force | ? { $_.PSIsContainer} | % { new-object PsObject -property @{ Length = (dir $_.FullName -recurse -force | ? {! $_.PSIsContainer} | measure-object -sum Length).Sum; Name = $_.Name ...
PowerShellCorpus/GithubGist/mmdemirbas_5253480_raw_a81daccee7dfbd44f7bb97f4e237e5dc83a886c7_battery.ps1
mmdemirbas_5253480_raw_a81daccee7dfbd44f7bb97f4e237e5dc83a886c7_battery.ps1
######################################################################### # # # Script to check battery state periodically and alert if it is # # going to outside of the desired range (%40-%80) by default. # # ...
PowerShellCorpus/GithubGist/JayBazuzi_d5a71230d524965057be_raw_cf46945ebd0b8472b00ff1545f742ceeff18b0f3_PreBuild.ps1
JayBazuzi_d5a71230d524965057be_raw_cf46945ebd0b8472b00ff1545f742ceeff18b0f3_PreBuild.ps1
# # keep this in synch with TeamBuild.proj # $ResharperCltVersion='8.2.0.2151' # UseBasicParsing is required if IE has never been run on the machine. wget -UseBasicParsing chocolatey.org/install.ps1 | iex if (!$?) { throw "failed to install chocolatey"} cinst resharper-clt.portable -version $ResharperCltVers...
PowerShellCorpus/GithubGist/psschroeter_53df461fe367abf714c2_raw_6b700b071c00ef994961a86cca5a63a456c19e25_xenstore_client.ps1
psschroeter_53df461fe367abf714c2_raw_6b700b071c00ef994961a86cca5a63a456c19e25_xenstore_client.ps1
param( [Parameter(Mandatory=$True,Position=0)][string]$command, [Parameter(Mandatory=$True,Position=1)][string]$value ) $sessionName = "XenStoreReader" $session = Get-WmiObject -Namespace root\wmi -Query "select * from CitrixXenStoreSession where Id='$sessionName'" if (!($session)) { $base = Get-WmiObj...
PowerShellCorpus/GithubGist/rverrips_11398327_raw_4939e39ea56b03fd5bdf347be345b0f0bb6fb1f0_move-vmstorage.ps1
rverrips_11398327_raw_4939e39ea56b03fd5bdf347be345b0f0bb6fb1f0_move-vmstorage.ps1
$newpath="C:\new\place\for\Hyper-V" get-vm | % { move-vmstorage $_ -DestinationStoragepath $($newpath+"\"+$_.VMName)}
PowerShellCorpus/GithubGist/mortenya_3a2c208c92ca0e64c597_raw_3e44cc2fad3df2482c4df4da75053e20cde03c39_Get-MemberOf.ps1
mortenya_3a2c208c92ca0e64c597_raw_3e44cc2fad3df2482c4df4da75053e20cde03c39_Get-MemberOf.ps1
(Get-ADUser –Identity $user –Properties MemberOf).MemberOf -replace '^CN=([^,]+),OU=.+$','$1' > c:\user-groups.txt # The -replace will strip the CN of the group from the Distinguished Name. # This isn't error proof, but will be adequate for most use cases when dealing with Security Groups.
PowerShellCorpus/GithubGist/mikecessna_b8c1cc3c63fc9ac7a2c9_raw_2b89845c2f61bbd0890c664657ef38563c81558e_find-serviceaccounts.ps1
mikecessna_b8c1cc3c63fc9ac7a2c9_raw_2b89845c2f61bbd0890c664657ef38563c81558e_find-serviceaccounts.ps1
# Script to find servers in AD and output any services running as a 'non-normal' account. #Load the AD module if not already loaded. If (!(Get-module Activedirectory )) {Import-Module OperationsManager} $systemservicenames=@("LocalSystem", "NT AUTHORITY\LocalService", "NT AUTHORITY\Local Service", ...
PowerShellCorpus/GithubGist/vScripter_10318913_raw_97485e2eac6fd61e30a1f9d89338df216cbe46e2_Invoke-LocalAdminAudit.ps1
vScripter_10318913_raw_97485e2eac6fd61e30a1f9d89338df216cbe46e2_Invoke-LocalAdminAudit.ps1
[cmdletbinding()] param ( [parameter(mandatory = $true)] [string[]]$Servers ) $results = @() $Log = "C:\Invoke-LocalAdminAudit.ps1.log" if (Test-Path $Log) { Remove-Item $Log -Force } Write-Verbose "Gathering Local Admin Membership..." ForEach ($server in $servers) { $Report = "C:\LocalAdminRepo...
PowerShellCorpus/GithubGist/jpoehls_2844751_raw_01159a5b7d411906fbb7a4b3ace89a13ea175838_Kill-VisualStudio.ps1
jpoehls_2844751_raw_01159a5b7d411906fbb7a4b3ace89a13ea175838_Kill-VisualStudio.ps1
function Kill-VisualStudio { <# .SYNOPSIS Kills all running 'devenv' instances. #> Get-Process devenv -ErrorAction SilentlyContinue | Stop-Process } Set-Alias killvs Kill-VisualStudio
PowerShellCorpus/GithubGist/glombard_10017705_raw_7ffe48e7beb0435a83e13d8c8dd730db4d70f171_unblock-files.ps1
glombard_10017705_raw_7ffe48e7beb0435a83e13d8c8dd730db4d70f171_unblock-files.ps1
if (!(Test-Path "$env:Temp\streams.exe")) { (new-object System.Net.WebClient).DownloadFile('http://live.sysinternals.com/streams.exe', "$env:Temp\streams.exe") } # "Unblock" the files... & "$env:Temp\streams.exe" @('-d', '*.*')
PowerShellCorpus/GithubGist/tophatsteve_2916858_raw_b5a8bb713535ddad4914b120c34e1a2766b88539_control-ie.ps1
tophatsteve_2916858_raw_b5a8bb713535ddad4914b120c34e1a2766b88539_control-ie.ps1
$ie = new-object -com "InternetExplorer.Application" $ie.visible = $true $ie.navigate("http://localhost/Default.aspx") $doc = $ie.document $link = $doc.getElementByID("link_01") $link.click()
PowerShellCorpus/GithubGist/andrewodri_46da27dab1e705f71b9c_raw_a89aff008767b8b6d53edcf7184e8789a1249d1f_elevating.ps1
andrewodri_46da27dab1e705f71b9c_raw_a89aff008767b8b6d53edcf7184e8789a1249d1f_elevating.ps1
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent(); $myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID); $adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator; Push-Location; Set-Location HKCU:\Console; if(!(Test-Path -Path ".\%SystemRoot...
PowerShellCorpus/GithubGist/slacker_1220314_raw_913d5de7f3a8cefb30c6afdf543df73a1c10bb56_netstat.ps1
slacker_1220314_raw_913d5de7f3a8cefb30c6afdf543df73a1c10bb56_netstat.ps1
# Based on code found at http://poshcode.org/2694 $null, $null, $null, $null, $netstat = netstat -ano $ps = Get-Process [regex]$regexTCP = '(?<Protocol>\S+)\s+(?<LAddress>\S+):(?<LPort>\S+)\s+(?<RAddress>\S+):(?<RPort>\S+)\s+(?<State>\S+)\s+(?<PID>\S+)' [regex]$regexUDP = '(?<Protocol>\S+)\s+(?<LAddress>\S+):(?...
PowerShellCorpus/GithubGist/cajones_3149699_raw_5dabe97eeeffcb143654c05f65a033c8766120f6_find-hiddendrives.ps1
cajones_3149699_raw_5dabe97eeeffcb143654c05f65a033c8766120f6_find-hiddendrives.ps1
function Find-HiddenDrive($server) { $alpha = [char[]]"cdefghijklmnopqrstuvwxyz" return $alpha | ? { test-path \\$server\$_`$ } }
PowerShellCorpus/GithubGist/GuruAnt_5442585_raw_710403f1c2d0f9a4a0596053474349def59f97cc_PowerCLIScriptExample2.ps1
GuruAnt_5442585_raw_710403f1c2d0f9a4a0596053474349def59f97cc_PowerCLIScriptExample2.ps1
# Loop through each VM ForEach ($objVM in ( Get-VM | Where-Object { # Where the configured memory is greater than 2000 $_.MemoryMB -gt "2000" } )){ # Get the VM guest object Get-VMGuest -VM $objVM | Where-Object { # Where the operating system is Windows XP $...
PowerShellCorpus/GithubGist/AdilHindistan_8701241_raw_420e8f279baee62bb9042eb61ead0e9bb3d72fe3_Invoke-CommandAST.ps1
AdilHindistan_8701241_raw_420e8f279baee62bb9042eb61ead0e9bb3d72fe3_Invoke-CommandAST.ps1
#requires -Version 3 #Usage: #Invoke-command -computername $server -scriptblock {FunctionName -param1 -param2} # Author: Matt Graeber # @mattifestation # www.exploit-monday.com function Invoke-Command { [CmdletBinding(DefaultParameterSetName='InProcess', HelpUri='http://go.microsoft.com/fwlink/?LinkID=135225', Re...
PowerShellCorpus/GithubGist/mfcollins3_4448042_raw_c0b067b4cc00d3ccc5eb72ff57b393c8350aa11b_gistfile1.ps1
mfcollins3_4448042_raw_c0b067b4cc00d3ccc5eb72ff57b393c8350aa11b_gistfile1.ps1
# This function will accept component GUIDs from the pipeline # and will attempt to find and delete the component records # in the Windows Installer registry hive if they exist. # # For whatever reason, Windows Installer reverses the GUIDs # when creating the component records in the registry. This # function imp...
PowerShellCorpus/GithubGist/pkirch_9a93bf2306e2d5419623_raw_7dcd77b3faae3b4aa1af77a47a7985a24d8df14d_GetAzureSubscription.ps1
pkirch_9a93bf2306e2d5419623_raw_7dcd77b3faae3b4aa1af77a47a7985a24d8df14d_GetAzureSubscription.ps1
Get-AzureSubscription <# Output SubscriptionId : c6244819-a8d6-4279-b492-4a47f4301c54 SubscriptionName : Azure MSDN - pkirchner Environment : AzureCloud SupportedModes : AzureServiceManagement DefaultAccount : 914193B3332ED5FFF26CECABB522B42AA08EDB0E Ac...
PowerShellCorpus/GithubGist/janikvonrotz_6866018_raw_9828f76124bfcee2685bed93c7f356499d9353c8_Get-ContentOfMultipleConfigurationFiles.ps1
janikvonrotz_6866018_raw_9828f76124bfcee2685bed93c7f356499d9353c8_Get-ContentOfMultipleConfigurationFiles.ps1
# Get Mail Error Report Configuration $MailConfigs = Get-ChildItem -Path $PSconfigs.Path -Filter $PSconfigs.Mail.Filter -Recurse | %{[xml]$(get-content $_.FullName)} | %{$_.Content.Mail | where{$_.Name -eq $PSconfigs.Mail.ErrorClass}} | select -first 1
PowerShellCorpus/GithubGist/bat2001_6232438_raw_ddac20a65bf965a4dda504cd6a793c91b2f7c075_gistfile1.ps1
bat2001_6232438_raw_ddac20a65bf965a4dda504cd6a793c91b2f7c075_gistfile1.ps1
[System.Reflection.Assembly]::loadwithPartialName("Microsoft.BizTalk.ExplorerOM") ## - Force 32-bit mode, BizTalk.ExplorerOM does NOT support 64-bit mode if ($env:Processor_Architecture -ne "x86") { write-warning "Running x86 PowerShell..." if ($myInvocation.Line) { &"$env:WINDIR\syswow64\windowspow...
PowerShellCorpus/GithubGist/guitarrapc_1d903d0b7913569adbb3_raw_bbf05c35705861c4372bc27db1c66fe0262aed6c_CanNotEvaluate.ps1
guitarrapc_1d903d0b7913569adbb3_raw_bbf05c35705861c4372bc27db1c66fe0262aed6c_CanNotEvaluate.ps1
"{ {0} }" -f $hoge.hoge <# Error formatting a string: Input string was not in a correct format.. At line:1 char:5 + "{ + ~~ + CategoryInfo : InvalidOperation: ({ {0} }:String) [], RuntimeException + FullyQualifiedErrorId : FormatError #>
PowerShellCorpus/GithubGist/mikeplate_4351975_raw_e9caa0d74430f785b46af6716f59b0c6696bbafb_gistfile1.ps1
mikeplate_4351975_raw_e9caa0d74430f785b46af6716f59b0c6696bbafb_gistfile1.ps1
# List all users $filter = "(&(objectClass=user)(objectCategory=person))" $users = ([adsiSearcher]$filter).findall() $users | %{ $_.Properties['displayname'] } # Sort $users | %{ $_.Properties['displayname'] } | sort # Filter by part of name $users | %{ $_.Properties['displayname'] } | where { $_ -match "John" }...
PowerShellCorpus/GithubGist/jamessantiago_52a8bf8b080461609023_raw_c71af878c886004add5b0ea1b67e9004de05fbaf_SetBackground.ps1
jamessantiago_52a8bf8b080461609023_raw_c71af878c886004add5b0ea1b67e9004de05fbaf_SetBackground.ps1
#expected to be executed from a folder with wallpapers in the format of BackGroundWIDTHxHEIGHT.jpg (e.g. Background1920x1200.jpg) $consoleDebug = $true $remoteDebug = $false $LogFile = "$($env:temp)\Wallpaper_$([int]((get-date -UFormat "%s") / 86400)).log" Function LogMessage($message) { if ($consoleDebug...
PowerShellCorpus/GithubGist/mefellows_9a67b17a571fcffa1bd0_raw_fd41f7383568ec492744a315fa1e502dbbe854fc_gistfile1.ps1
mefellows_9a67b17a571fcffa1bd0_raw_fd41f7383568ec492744a315fa1e502dbbe854fc_gistfile1.ps1
#$Shell.WindowTitle="WinOps Matt" set-executionpolicy unrestricted new-item alias:subl -value 'C:\Program Files\Sublime Text 3\sublime_text.exe' new-item alias:ll -value 'ls'
PowerShellCorpus/GithubGist/kouphax_1150017_raw_4a30801c74dedbd083d3e46c8b4a2adf8f427430_default.ps1
kouphax_1150017_raw_4a30801c74dedbd083d3e46c8b4a2adf8f427430_default.ps1
# ----------------------------------------------------------------------------- # H E L P E R F U N C T I O N S # ----------------------------------------------------------------------------- function Write-LineBreak(){ Write-Host "------------------------------------------------------------...
PowerShellCorpus/GithubGist/catyun_6393348_raw_1bf416251759be865217155d20ad58b5543f2a45_init.ps1
catyun_6393348_raw_1bf416251759be865217155d20ad58b5543f2a45_init.ps1
$content = Get-Content -path d:\context.sh $context = @{} # Read All Context Variables from context.sh foreach ($line in $content) { if ($line[0] -ne '#') { $var = $line.split('=') if ($var[1] -ne $null) { #remove the " " of variables $var[1] = $var[1...
PowerShellCorpus/GithubGist/guitarrapc_e17fa71083847c9ba78d_raw_7531bd7b3fb08a7a50f0c53935f492e5afe67368_PowershellConstructor.ps1
guitarrapc_e17fa71083847c9ba78d_raw_7531bd7b3fb08a7a50f0c53935f492e5afe67368_PowershellConstructor.ps1
######################## # Constructor Call check ######################## class Hoge { Hoge() { Write-Host "constuctor called" } } [Hoge]::new() <# constuctor called #> ######################## # Initialization ######################## class MyClass { [string]$name ...
PowerShellCorpus/GithubGist/amatashkin_6593347_raw_766219eaa7927db56cbb4ee49289f5399a6c1426_backup-computer.ps1
amatashkin_6593347_raw_766219eaa7927db56cbb4ee49289f5399a6c1426_backup-computer.ps1
#script will backup computer to backup location clear $date = get-date -UFormat %Y-%m-%d $comp = gc env:computername $share = (Get-Location).Drive.Name + ':' $folder = $share + '\WindowsImageBackup\' $log = $folder + $date + '_' + $comp + '.log' # Create backup folder try { if ( ! (Test-Path -Path $folder ) ){ ...
PowerShellCorpus/GithubGist/miwaniza_9041042_raw_fb97311756dccedc091f358af6ff9f19c6ffcf65_Login-VaultServer-Cmd_Ed.ps1
miwaniza_9041042_raw_fb97311756dccedc091f358af6ff9f19c6ffcf65_Login-VaultServer-Cmd_Ed.ps1
param ($help,$VServer,$VVault,$VUser,$VPass,$VOut) $WebServicesPath2014="C:\Program Files (x86)\Autodesk\Autodesk Vault 2014 SDK\bin\Autodesk.Connectivity.WebServices.dll" if ($help) { "Login Vault with read-only connection`n" "Usage:" " Login-VaultServer.ps1 -Vserver <server address> -VVault <vault name> -V...
PowerShellCorpus/GithubGist/alias1_6101928_raw_77a63a62f8b3c602254633c0e04e6f6aecdcaf6a_Powershell_Reverse-SecureString.ps1
alias1_6101928_raw_77a63a62f8b3c602254633c0e04e6f6aecdcaf6a_Powershell_Reverse-SecureString.ps1
# Reverse-SecureString # Version: 1.0 (20130729) # Created By: Glenn 'devalias' Grant (http://devalias.net) # License: The MIT License (MIT) - Copyright (c) 2013 Glenn 'devalias' Grant (see http://choosealicense.com/licenses/mit/ for full license text) function Reverse-SecureString([string]$secureString,[string]$key) {...
PowerShellCorpus/GithubGist/jorke_6879224_raw_30567258f00887f0cf013a03059e6d5a29f06ee7_ses.ps1
jorke_6879224_raw_30567258f00887f0cf013a03059e6d5a29f06ee7_ses.ps1
Send-MailMessage -From <from> -to <to> -subject <subject> -SmtpServer email-smtp.us-east-1.amazonaws.com -Credential $(New-Object System.Management.Automation.PSCredential -argumentlist <AWS_ACCESS_KEY>, $(ConvertTo-SecureString -AsPlainText -String <AWS_SECRET_KEY> -Force) ) -UseSsl -Port 587
PowerShellCorpus/GithubGist/rogasawara_6916476_raw_a9d960e07b148321145371bf057f06a9e6304654_memo.ps1
rogasawara_6916476_raw_a9d960e07b148321145371bf057f06a9e6304654_memo.ps1
# いろいろなな処理の検証 # 開始時刻 echo "処理を開始します" Get-Date -Format "yyyy/MM/dd HH時mm分ss秒" | echo #変数準備 $out = @() $conv = @{} #カレントディレクトリ取得 $path = (Split-Path ( & { $myInvocation.ScriptName } ) -parent) # 移動 cd $path/HOGE # ファイル名取得しリスト化 $hoge = @() # 以下の拡張子を含むものは対象外 $hoge = Get-ChildItem -exclude *.exe,...
PowerShellCorpus/GithubGist/jakeballard_9019696_raw_6d5dac19e0067c27ad742a4bfeefc12b952e3c0f_Get-TSMClientSchedule.ps1
jakeballard_9019696_raw_6d5dac19e0067c27ad742a4bfeefc12b952e3c0f_Get-TSMClientSchedule.ps1
function Get-TSMClientSchedule { Param( [Parameter(Mandatory=$true, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$true)] $ComputerName ) PROCESS { if ($ComputerName -is [Array]) { $ComputerName | ForEach-Object { Get-TSMSchedule -ComputerName $_ } } else {...
PowerShellCorpus/GithubGist/bblade_4713294_raw_4777f8f97145bba4127065e9373cb6e415fd1038_Purge-Old-Items.ps1
bblade_4713294_raw_4777f8f97145bba4127065e9373cb6e415fd1038_Purge-Old-Items.ps1
# Set variables $HomeFolder = "C:\TEMP" $KeepDays = "-1" $Date = Get-Date $PurgeDays = $Date.AddDays($KeepDays) # Execute commands Get-ChildItem $HomeFolder -Recurse | ` Where-Object { $_.CreatedTime -lt $PurgeDays } | ` Remove-Item -Recurse
PowerShellCorpus/GithubGist/uncas_1931516_raw_c7768a0e9d3c663035915f2d5304738237e32d90_profile.ps1
uncas_1931516_raw_c7768a0e9d3c663035915f2d5304738237e32d90_profile.ps1
# My preferred prompt for Powershell. # Displays git branch (and stats) when inside a git repository. # See http://gist.github.com/180853 for gitutils.ps1. . (Resolve-Path D:/Users/ole/Documents/WindowsPowershell/gitutils.ps1) function prompt { $userLocation = $env:username + ' ' + $pwd $host.UI.RawUi.Wind...
PowerShellCorpus/GithubGist/kouphax_1150018_raw_c5d57926c655e4bd581efb8004a96625213a6c88_default.ps1
kouphax_1150018_raw_c5d57926c655e4bd581efb8004a96625213a6c88_default.ps1
# Set the default framework (3.5 by default) $framework = '4.0'
PowerShellCorpus/GithubGist/mpicker0_5680072_raw_88756c9d6cf306e0b0824a6cd98b917f06a3ee03_Create-WebConfigTransform.ps1
mpicker0_5680072_raw_88756c9d6cf306e0b0824a6cd98b917f06a3ee03_Create-WebConfigTransform.ps1
<# .SYNOPSIS Create a configuration transformation .DESCRIPTION This script runs an ASP.NET configuration transformation, given a source configuration and transformation file. MSBuild.exe is assumed to be in the path, and Visual Studio 2012 should be installed. Modify the path to Microsoft.Web.Publishing.Tas...
PowerShellCorpus/GithubGist/zulucoda_81cd751f67a8cbba3605_raw_91ba95e503bd00ce01c0fce3eae22f326ffa0e52_create-web-application-in-iis.ps1
zulucoda_81cd751f67a8cbba3605_raw_91ba95e503bd00ce01c0fce3eae22f326ffa0e52_create-web-application-in-iis.ps1
<# .SYNOPSIS create-web-application - Automatic website creation. .DESCRIPTION Allows you to create a website and its ApplicationPool. .NOTES File Name : create-web-application.ps1 Author : Muzikayise Flynn Buthelezi - muzi@mfbproject.co.za Copyright : MFBproject mfbproject.c...
PowerShellCorpus/GithubGist/tathamoddie_448023_raw_31fe02e3d1ec49547e7aec243746f5976ba10d26_Publish-Version.ps1
tathamoddie_448023_raw_31fe02e3d1ec49547e7aec243746f5976ba10d26_Publish-Version.ps1
#requires -Version 2 [CmdletBinding()] param ( $VersionIdentifier ) $ErrorActionPreference = "Stop" Set-PSDebug -Strict $PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName $PSScriptRoot = Split-Path $PSScriptFilePath -Parent $StaticRoot = Split-Path $PSScriptRoot -Parent if ($Version...
PowerShellCorpus/GithubGist/pkskelly_e94c9fb69511de35c6db_raw_a479b66f9eb6f62e02f6125889fa79a7feb35b05_Install-DevTools.ps1
pkskelly_e94c9fb69511de35c6db_raw_a479b66f9eb6f62e02f6125889fa79a7feb35b05_Install-DevTools.ps1
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) ##Developer Tools #cinst sysinternals #cinst 7zip cinst diffmerge #cinst winmerge #cinst fiddler #cinst paint.net #cinst githubforwindows cinst npm cinst ilspy ## Languages #cinst python ##Editors #cinst SublimeTe...
PowerShellCorpus/GithubGist/dfinke_8127413_raw_e789ce79fb7bd06fc0231be99a6a8a711f5d38e9_ConvertTo-PigLatin.ps1
dfinke_8127413_raw_e789ce79fb7bd06fc0231be99a6a8a711f5d38e9_ConvertTo-PigLatin.ps1
function ConvertTo-PigLatin { param( [Parameter(ValueFromPipeline)] [string[]]$string ) Process { $r += $(foreach($s in $string) { if(Write-Output b c d f g h j k l m n p q r s t v w x y z -eq $s[0]) { "{0}{1}ay" -f ($s[1..($s.lengt...
PowerShellCorpus/GithubGist/gravejester_5041912_raw_48ffa67143e9dd018c82914916ac64d575f65e37_Trace-Route.ps1
gravejester_5041912_raw_48ffa67143e9dd018c82914916ac64d575f65e37_Trace-Route.ps1
function Trace-Route { <# .SYNOPSIS Trace the route between source computer and a target machine. .DESCRIPTION Trace the route between source computer and a target machine. .EXAMPLE Trace-Route Computer01 Perform trace route to Computer01 ...
PowerShellCorpus/GithubGist/InPermutation_6625573_raw_ef80e2d2fe812cda0ee7310530562941b264a58c_gistfile1.ps1
InPermutation_6625573_raw_ef80e2d2fe812cda0ee7310530562941b264a58c_gistfile1.ps1
$treeish = "my_tag" # $treeish = "my_branch" # $treeish = "900fe0a22ea332fcbfdb4b0bc7136760ea30cc19" # $treeish = "900fe0a22" $exists = [bool](git rev-parse --quiet --verify $treeish) $ref = [bool](git show-ref $treeish) $sha = -not $ref # Check if it's a tag. (Careful; --list uses shell wildcard syntax) $t...
PowerShellCorpus/GithubGist/sean-m_11262491_raw_be82039e1a9210d0cc2a61201b090b3e02a0d76c_EvenSpace.ps1
sean-m_11262491_raw_be82039e1a9210d0cc2a61201b090b3e02a0d76c_EvenSpace.ps1
<# Takes a string and returns a string of tab characters wide enough to make the input string take up the specified character width in $tabWidth. Useful when outputing values in a loop but haven't setup pipelining to take advantage of Format-Table. I've only tested it in PS-ISE, may not work in a termin...
PowerShellCorpus/GithubGist/tugberkugurlu_4223615_raw_6d41c07a6fa3bd74f796deeec8e69d33e1406e4b_EnvVar.ps1
tugberkugurlu_4223615_raw_6d41c07a6fa3bd74f796deeec8e69d33e1406e4b_EnvVar.ps1
#Set Machine level #Elevated console is required [Environment]::SetEnvironmentVariable("VarName", "Value", "Machine") #Set Current User Level [Environment]::SetEnvironmentVariable("VarName", "Value", "User") #Get All vars dir env:\ #Get specific var $env:MyVal
PowerShellCorpus/GithubGist/AaronOnTheHub_510d7408aaf163c009b3_raw_5ca8ea542dc94bbcca6f6f34c852efd6caeeb38d_Count-Down.ps1
AaronOnTheHub_510d7408aaf163c009b3_raw_5ca8ea542dc94bbcca6f6f34c852efd6caeeb38d_Count-Down.ps1
############################################################################## #.SYNOPSIS # A count down. # #.DESCRIPTION # Counts down from a number to zero, displaying the current step, with the # ability to control mucho. # #.PARAMETER startMessage # Output prior to beginning of the countdown. Defaults to empty str...
PowerShellCorpus/GithubGist/paulcbetts_1944933_raw_ae9898129bc470a4d66f8a0113e892063d84f6a6_clean-merged-branches.ps1
paulcbetts_1944933_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/gravejester_3714f9ac60dcefb7721e_raw_b70db10cd961a5a2850980647b47ea75f25003ea_Test-Connection.ps1
gravejester_3714f9ac60dcefb7721e_raw_b70db10cd961a5a2850980647b47ea75f25003ea_Test-Connection.ps1
function Test-Connection { [CmdletBinding(DefaultParameterSetName='Default', HelpUri='http://go.microsoft.com/fwlink/?LinkID=135266', RemotingCapability='OwnedByCommand')] param( [Parameter(ParameterSetName='Default')] [Parameter(ParameterSetName='Source')] [switch] ${AsJob...
PowerShellCorpus/GithubGist/slacker_1222933_raw_8d0680fb79c2ee7c8b05789da369e20b392c89f5_siastatus.ps1
slacker_1222933_raw_8d0680fb79c2ee7c8b05789da369e20b392c89f5_siastatus.ps1
$path = "c:\usr\local\monitor\log\status" if ( ! (Test-Path $path)) { Write-Error "Status file not found!" exit } # Don't care about the first four lines $null, $null, $null, $null, $siastatusfile = Get-Content $path # Matches normal lines # PORT_OpswAgent 0 INST:1 300 Armed/Normal ...
PowerShellCorpus/GithubGist/JC1738_8585800_raw_fddf6fea3c86f9aac9443840af9cd84e9515d7cd_user_data.ps1
JC1738_8585800_raw_fddf6fea3c86f9aac9443840af9cd84e9515d7cd_user_data.ps1
<powershell> ##### #DON'T FORGET TO SET/CHANGE THE USERNAME/PASSWORD BELOW!!!!!!!!!! ##### $user="opscode" $password="opscode" #Disable password complexity requirements "[System Access]" | out-file c:\delete.cfg "PasswordComplexity = 0" | out-file c:\delete.cfg -append "[Version]" | out-file c:\delete...
PowerShellCorpus/GithubGist/9to5IT_9620565_raw_04b5a0e0d62290ccf025de4ab9c75597a75d6d9c_Logging_Functions.ps1
9to5IT_9620565_raw_04b5a0e0d62290ccf025de4ab9c75597a75d6d9c_Logging_Functions.ps1
Function Log-Start{ <# .SYNOPSIS Creates log file .DESCRIPTION Creates log file with path and name that is passed. Checks if log file exists, and if it does deletes it and creates a new one. Once created, writes initial logging data .PARAMETER LogPath Mandatory. Path of where log is to be crea...
PowerShellCorpus/GithubGist/victorvogelpoel_8388014_raw_38e74f8d328c59ae75134c4eea085b12a4249efa_Measure-ScriptCode.ps1
victorvogelpoel_8388014_raw_38e74f8d328c59ae75134c4eea085b12a4249efa_Measure-ScriptCode.ps1
# Measure-ScriptCode.ps1 # Return metrics about the script and module files # PowerShell 3 is required as Abstract Syntax Trees are used. # Jan 2014 # If this works, Victor Vogelpoel <victor.vogelpoel@macaw.nl> wrote this. # If it doesn't, I don't know who wrote this. # # Disclaimer # This script is provided ...
PowerShellCorpus/GithubGist/rkeithhill_3e7f3bd8daf9ca45b066_raw_9afdd486ffdabc944afd25d523f1709da8d706ec_PSReadlineConfiguration.ps1
rkeithhill_3e7f3bd8daf9ca45b066_raw_9afdd486ffdabc944afd25d523f1709da8d706ec_PSReadlineConfiguration.ps1
# Install this in your $profile.CurrentUserAllHosts file # This will enable and configure PSReadline for all PowerShell console sessions. if ($host.Name -eq 'ConsoleHost') { Import-Module PSReadline Set-PSReadlineOption -MaximumHistoryCount 10000 -HistorySearchCursorMovesToEnd -HistoryNoDuplicates -Histor...
PowerShellCorpus/GithubGist/pierre3_d9f567c838e5b536069f_raw_5bd79693302abd922d6ba6cc3efd81bca1ba8034_Search-Web.ps1
pierre3_d9f567c838e5b536069f_raw_5bd79693302abd922d6ba6cc3efd81bca1ba8034_Search-Web.ps1
<# .Synopsis Web検索 .DESCRIPTION Google検索を行い、検索結果リンクのタイトルとUrlを取得します .EXAMPLE $words = 'powerShell', 'script', 'example' $words | Search-Web .EXAMPLE Search-Web powerShell,script,example #> function Search-Web { [CmdletBinding()] Param( # 検索ワード [Parameter(Mandat...
PowerShellCorpus/GithubGist/gitforhf_ab518fd9fef5b2558308_raw_e9cfb0c8037b4724232ead3875530faa0d6c06e7_gistfile1.ps1
gitforhf_ab518fd9fef5b2558308_raw_e9cfb0c8037b4724232ead3875530faa0d6c06e7_gistfile1.ps1
60 $hadoop hce \ 61 -D mapred.job.name="${job_name}" \ 62 -D mapred.map.tasks.speculative.execution=false \ 63 -D mapred.reduce.tasks.speculative.execution=false \ 64 -D mapred.reduce.memory.limit=1000 \ 65 -D mapred.job.reduce.capacity=1200 \ 66 ...
PowerShellCorpus/GithubGist/gravejester_c713cb3cebe410463dbc_raw_6932f91b2ebe8a46eebd13c92a073af2bd7e800f_Get-Mockaroo.ps1
gravejester_c713cb3cebe410463dbc_raw_6932f91b2ebe8a46eebd13c92a073af2bd7e800f_Get-Mockaroo.ps1
# the EnumUtils code was nicked from Wayne Hartman (http://blog.waynehartman.com/articles/84.aspx) Add-Type -TypeDefinition @" using System; using System.Reflection; using System.ComponentModel; public enum MockarooType { Boolean, City, Color, [DescriptionAt...
PowerShellCorpus/GithubGist/ctrlbold_3c2eeab7a311b6971c9a_raw_9df3720c665b3700c7d46f99bab91e420a038943_Invoke-Locate.ps1
ctrlbold_3c2eeab7a311b6971c9a_raw_9df3720c665b3700c7d46f99bab91e420a038943_Invoke-Locate.ps1
<# .SYNOPSIS Fans of (Linux/UNIX) GNU findutils' locate will appreciate Invoke-Locate, which provides similar functionality. "locate" and "updatedb" aliases are automatically created. .DESCRIPTION This script was made in the spirit of GNU locate. While the name of this script is Invoke-Locate, it actually...
PowerShellCorpus/GithubGist/sandrinodimattia_4215259_raw_b6fb9802b02341e109bcc6dfb548b17011fe2350_gistfile1.ps1
sandrinodimattia_4215259_raw_b6fb9802b02341e109bcc6dfb548b17011fe2350_gistfile1.ps1
# Remove RDP endpoints from VMs in cloud service Get-AzureVM -ServiceName myservice | Remove-AzureEndpoint -Name RemoteDesktop | Update-AzureVM # Add RDP endpoints to all VMs in cloud service Get-AzureVM -ServiceName myservice | Add-AzureEndpoint -Name RemoteDesktop -LocalPort 3389 -Protoc...
PowerShellCorpus/GithubGist/amatashkin_6605833_raw_1f7065eeb89ea24c561de51f03a2856140b6d515_backup-gists.ps1
amatashkin_6605833_raw_1f7065eeb89ea24c561de51f03a2856140b6d515_backup-gists.ps1
$githubname = '' $githubname = Read-Host "Enter GitHub account name" if ($githubname) { $dirname = "gists_" + $githubname $dirname = Read-Host "Enter local directory name ($dirname)" if ( !($dirname)) {$dirname = "gists_" + $githubname } if ( !(Test-Path -path $dirname)){ New-Item -Path $dirname -ItemType ...
PowerShellCorpus/GithubGist/ao-zkn_0356a22e5d9a8b2cbb0b_raw_d3e56bef0db451682b090f88e24619b01fdee0fe_Get-URLEncode.ps1
ao-zkn_0356a22e5d9a8b2cbb0b_raw_d3e56bef0db451682b090f88e24619b01fdee0fe_Get-URLEncode.ps1
# ------------------------------------------------------------------ # 指定した文字コードより、文字列をURLエンコードする # 関数名:Get-URLEncode # 引数 :VALUE URLエンコードする文字列 # :ENCODING 文字コード # 戻り値:URLエンコードした文字列 # ------------------------------------------------------------------ function Get-URLEncode([String]$VALUE, [String]$ENCODING){ ...
PowerShellCorpus/GithubGist/SLaks_9752028_raw_da99bcf89c76bd8b2d162f711e158a43de2ade94_Reference-DLLs.ps1
SLaks_9752028_raw_da99bcf89c76bd8b2d162f711e158a43de2ade94_Reference-DLLs.ps1
$names = "Microsoft.VisualStudio.VisualBasic.LanguageService", "Microsoft.VisualBasic.Editor", "Microsoft.VisualBasic.LanguageService", "Microsoft.VisualStudio.CSharp.Services.Language", "Microsoft.VisualStudio.CSharp.Services.Language.Interop" $regex = "(" + (($names | ForEach-Object {[System.Text.Regula...
PowerShellCorpus/GithubGist/pjfontillas_2798f4b076ce583ecf31_raw_eeb8f9ece682743b230bfd5bd78e707a03100e4d_Microsoft.PowerShell_profile.ps1
pjfontillas_2798f4b076ce583ecf31_raw_eeb8f9ece682743b230bfd5bd78e707a03100e4d_Microsoft.PowerShell_profile.ps1
# run this to allow scripting # Set-ExecutionPolicy Unrestricted -Scope CurrentUser # $PROFILE support # Notepad is always available, but text editor can be overridden Function Edit-Profile { Param ( [Parameter()] [string]$editor ) if (!$editor){ #echo "Using Notepad to edit $PROFILE" Notepad $PROF...
PowerShellCorpus/GithubGist/Kruzen_8720595_raw_c1773499fbd85a5bc31d47606927f9f801b5ffd7_Notify-VdiDisconnectedSessions.ps1
Kruzen_8720595_raw_c1773499fbd85a5bc31d47606927f9f801b5ffd7_Notify-VdiDisconnectedSessions.ps1
Import-Module RemoteDesktop Get-RDUserSession | Where-Object SessionState -eq STATE_DISCONNECTED $ADServer = "" $from = "" $subject = "Improper Logoff From: $($user.CollectionName)" $body = "Hello $($user.UserName), `n`nPlease log back on to your VDI $($user.CollectionName) Session and select `"Log Off`" from the ...
PowerShellCorpus/GithubGist/ReubenBond_1387620_raw_cba96c3277343062ba2b53766f94d9b799c0ad1f_Disable-AutomaticallyDetectSettings.ps1
ReubenBond_1387620_raw_cba96c3277343062ba2b53766f94d9b799c0ad1f_Disable-AutomaticallyDetectSettings.ps1
# Disable 'Automatically detect proxy settings' in Internet Explorer. function Disable-AutomaticallyDetectProxySettings { # Read connection settings from Internet Explorer. $regKeyPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\" $conSet = $(Get-ItemProperty $regKe...
PowerShellCorpus/GithubGist/MikeAStevenson_646a079f09c641679c5b_raw_382dd997af2781f4d17b732921ab694cb42c1f62_Enable-RDP.ps1
MikeAStevenson_646a079f09c641679c5b_raw_382dd997af2781f4d17b732921ab694cb42c1f62_Enable-RDP.ps1
# # Author: M. Stevenson # Desc : Enable RDP on a remote computer, given the hostname or IP # Date : 2014-11-04 - M. Stevenson - Initial Version # Function Enable-RDP { [CmdletBinding()] param( [parameter(Mandatory=$true,ValueFromPipeline=$true,HelpMessage="Enter the name/IP of the computer ...
PowerShellCorpus/GithubGist/stefanstranger_b4c75d440469f1dc25c7_raw_1fdcda0625e9ac8e70416cb4bceefb533f7fd983_InstallISEWinMergeModule.ps1
stefanstranger_b4c75d440469f1dc25c7_raw_1fdcda0625e9ac8e70416cb4bceefb533f7fd983_InstallISEWinMergeModule.ps1
$webclient = New-Object System.Net.WebClient $url = "https://github.com/stefanstranger/ISEWinMerge/archive/master.zip" Write-Host "Downloading latest version of ISEWinMerge from $url" -ForegroundColor Cyan $file = "$($env:TEMP)\ISEWinMerge.zip" if (Test-path "$targetondisk\ISEWinMerge"){remove-item $targetondisk"\I...
PowerShellCorpus/GithubGist/AdamNaj_5e0e040d91b04359df1d_raw_4dee4e1e0f976cf5510e9c6f9647dcd3410e5302_change_image_field.ps1
AdamNaj_5e0e040d91b04359df1d_raw_4dee4e1e0f976cf5510e9c6f9647dcd3410e5302_change_image_field.ps1
#item I want to set the field on $item = get-item "master:/content/home" #image I want to use $image = new-object -TypeName "Sitecore.Data.Items.MediaItem" -ArgumentList (get-item "master:/media library/Showcase/cognifide_logo") #field I want to set on $item $imageField = [Sitecore.Data.Fields.ImageField]$item.Fields...
PowerShellCorpus/GithubGist/jstangroome_485519_raw_b362f62b5c2b866767ab5cb306ff878e043c9d65_Export-TfsCollectionReports.ps1
jstangroome_485519_raw_b362f62b5c2b866767ab5cb306ff878e043c9d65_Export-TfsCollectionReports.ps1
#requires -version 2.0 [CmdletBinding()] param ( [parameter(Mandatory=$true)] [ValidatePattern('^https?://')] [string] $TeamProjectCollectionUri, [parameter(Mandatory=$true)] [string] $Destination ) function Ensure-Path ($Path) { if (-not ($Path | Test-Path -PathType ...
PowerShellCorpus/GithubGist/thecodejunkie_1384038_raw_216e03b0219dd0b68c8e8043787c6b56a764a1e9_Continuous-CoffeeScript.ps1
thecodejunkie_1384038_raw_216e03b0219dd0b68c8e8043787c6b56a764a1e9_Continuous-CoffeeScript.ps1
# watch a file changes in the current directory, # compile when a .coffee file is changed or renamed # Wrapped Graeme's version up into a function so it can be installed with install-module # Also changed so it invoked coffee.exe directly, you need Coffee for Windows in your PATH for it to work # https://github.co...
PowerShellCorpus/GithubGist/scotro_64be96a44170ab693a8b_raw_ee155d6f7d48a4d4e9a4ee7f4fb5069b13c0e0bd_win-grep.ps1
scotro_64be96a44170ab693a8b_raw_ee155d6f7d48a4d4e9a4ee7f4fb5069b13c0e0bd_win-grep.ps1
Get-ChildItem C:\ -include *.txt -rec -ErrorAction SilentlyContinue | Select-String -pattern "^(?:[0-9A-Z]{5}-){4}[0-9A-Z]{5}$" -ErrorAction SilentlyContinue
PowerShellCorpus/GithubGist/pkirch_4648d7899619e7c8ec7f_raw_14aff94802945bafecfd339df21ad7a7ab7af06b_Get-RelatedCommand.ps1
pkirch_4648d7899619e7c8ec7f_raw_14aff94802945bafecfd339df21ad7a7ab7af06b_Get-RelatedCommand.ps1
# Sample by Peter Kirchner (peter.kirchner@microsoft.com) PS C:\Users\pkirch> Get-Command -Module Azure -Noun AzureService <# Output CommandType Name ModuleName ---...
PowerShellCorpus/GithubGist/janegilring_5595200_raw_f9a24077368e7e27fa75cf79c67f947131aecbe7_2013SGEvent3AdvancedSample.ps1
janegilring_5595200_raw_f9a24077368e7e27fa75cf79c67f947131aecbe7_2013SGEvent3AdvancedSample.ps1
function Ping-SYHost ([string] $hostName) { <#     .SYNOPSIS         Tests server availability by using PING command.               .DESCRIPTION         This script will ping a host and return TRUE/FALSE.  Use this function to determine if the host is reachable.                     .EXAMPLE         Ping-SYHost...
PowerShellCorpus/GithubGist/hotpicklesoup_a084d3da7475b8584728_raw_5d7c65cf5460bc2e8c3e9693b3a9e866a0c30ced_UpdateFirewallConfig.ps1
hotpicklesoup_a084d3da7475b8584728_raw_5d7c65cf5460bc2e8c3e9693b3a9e866a0c30ced_UpdateFirewallConfig.ps1
function UpdateFirewallConfig { Param ( $SRC_config, $DST_config ) # Compare the sections to see if the are new, existing, or extraneous. $diff_sections = Compare-Object $dst_config.firewallconfiguration.layer3sections.section $src_config.firewallconfiguration.layer3sections.section -Property name -Includ...
PowerShellCorpus/GithubGist/davideicardi_22b13fc76b180c9a7399_raw_01564ab42d311e7fe6b5fc86016eaca5494a67f3_script.ps1
davideicardi_22b13fc76b180c9a7399_raw_01564ab42d311e7fe6b5fc86016eaca5494a67f3_script.ps1
Function Install-PoshSsh { # https://github.com/darkoperator/Posh-SSH # http://www.powershellmagazine.com/2014/07/03/posh-ssh-open-source-ssh-powershell-module/ if(-not(Get-Module -name posh-ssh)) { $webclient = New-Object System.Net.WebClient $url = "https://github.com/darkop...
PowerShellCorpus/GithubGist/srkirkland_3694398_raw_19ed21ddcc03b1cbe4719a133f7b259dce540acb_deploy.ps1
srkirkland_3694398_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/ziembor_5267404_raw_4a1e493e31395a5e8c922dc0596d1710d834e5dd_get-ADUsersWithManagerGroupMemberShipsFlatFiles.ps1
ziembor_5267404_raw_4a1e493e31395a5e8c922dc0596d1710d834e5dd_get-ADUsersWithManagerGroupMemberShipsFlatFiles.ps1
$users = get-ADUser -Filter * -Properties manager | where {$_.manager -ne $null} foreach ($user in $users) { $userSAM = $user.SamAccountName $manager = get-ADUser $user.Manager $managerSAM = $manager.SamAccountName $managerName = $manager.Name $plik = "info_+_$($managerSAM)_+_$($userSAM).txt" write-host "pli...
PowerShellCorpus/GithubGist/jrotello_3858994_raw_d8209427f8f0de01fde2e52f75e5ab07e2dae4d0_volunteer.ps1
jrotello_3858994_raw_d8209427f8f0de01fde2e52f75e5ab07e2dae4d0_volunteer.ps1
function Get-Volunteers { [CmdletBinding()] param( [int]$count = 1, [array]$values = @(), [string]$file = "" ) if ($file -ne "") { Get-Content $file | % { $values += $_ } } Write-Verbose "Volunteer Pool" Write-Verbose "========================="...
PowerShellCorpus/GithubGist/mefellows_80b05f8af9fd9f526ec5_raw_6852550c5c760522bc32ecf15d5716c28b8317db_vagrant-bootstrapper.ps1
mefellows_80b05f8af9fd9f526ec5_raw_6852550c5c760522bc32ecf15d5716c28b8317db_vagrant-bootstrapper.ps1
Write-Host -ForegroundColor green "Bootstrapping machine" Write-Host "Setting up package management and installing required packages for Dev." # # Install Choco (if not already installed) + required packages # if ( (Get-Command "choco" -errorAction SilentlyContinue) ) { Write-Host "Chocolatey already inst...