full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/GithubGist/erichexter_b0cca2ff2e3ab120cec8_raw_b9214ff0cbd89ee1d5504a1078db5c1417602a87_gistfile1.ps1 | erichexter_b0cca2ff2e3ab120cec8_raw_b9214ff0cbd89ee1d5504a1078db5c1417602a87_gistfile1.ps1 |
function bootstrap-tentacle{
param($username,$password,$environments,$roles)
$rolestring="@(""" + ($roles -join """,""") + """)"
$environmentstring="@(""" + ($environments -join """,""") + """)"
$command = ". c:\redist\configuremachine.ps1;install-tentacle -environments $environmentstri... |
PowerShellCorpus/GithubGist/cbilson_1309783_raw_9c29a5a52b718ff54efeaef856238d8e979d5ecc_Foo.ps1 | cbilson_1309783_raw_9c29a5a52b718ff54efeaef856238d8e979d5ecc_Foo.ps1 |
task Start-Coffee-Watcher -Description "when a coffee file changes recompile - for testing" {
Start-Job -Name "CoffeeWatcher" -ArgumentList "$srcDir\WebRole\scripts" -ScriptBlock {
param($scriptsFolder)
Write-Host "Watching $scriptsFolder"
$recompile = {
# TODO: Figure out how to recomp... |
PowerShellCorpus/GithubGist/whatisinternet_7686349_raw_3bc5de8a09f163bad5ea1b1951e973e34f15c339_metroRemove.ps1 | whatisinternet_7686349_raw_3bc5de8a09f163bad5ea1b1951e973e34f15c339_metroRemove.ps1 | #----------------------------
# Filename: MetroRemove.ps1
# Author: Josh Teeter
# Date: 2013-05-06
# Version: 1.0.0.5
# Purpose: This will remove metro apps based on a list of applications in a file called Crapps.txt
#----------------------------
$Diagnostics = 0
$DumpApps = 0
#
# Determine how ... |
PowerShellCorpus/GithubGist/rysstad_d0b9999863683366eadd_raw_5913f5d21cfc1f04ca85383b2a5d332050c09093_New-TempFileName.ps1 | rysstad_d0b9999863683366eadd_raw_5913f5d21cfc1f04ca85383b2a5d332050c09093_New-TempFileName.ps1 | # Create name and path for a tempfile
[System.IO.Path]::GetTempFileName()
|
PowerShellCorpus/GithubGist/johnmiller_a9f2b18bceed19c172a0_raw_ca4da8e8b634d946d31d36e50a465e5c53ccaf6b_random%20powershell%20commands.ps1 | johnmiller_a9f2b18bceed19c172a0_raw_ca4da8e8b634d946d31d36e50a465e5c53ccaf6b_random%20powershell%20commands.ps1 | # running commands
iex 'myprogram.exe myarg' # Invoke-Expression, alias iex
& '"myprogram.exe" "myarg"' # use & when using quotes
# download and install PsGet
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
Install-Module PsReadLine
|
PowerShellCorpus/GithubGist/writeameer_675207_raw_6fcac5dc175379f135b5540f9c02e56bcd8ba315_git_install_windows.ps1 | writeameer_675207_raw_6fcac5dc175379f135b5540f9c02e56bcd8ba315_git_install_windows.ps1 | # Set download URLs
$git_download_url = "http://msysgit.googlecode.com/files/PortableGit-1.7.3.1-preview20101002.7z"
$7zip_download_url = "http://downloads.sourceforge.net/sevenzip/7za465.zip"
# Create Software folder
$software_folder = "$env:SystemDrive\software"
mkdir -force $software_folder
# Create temp ... |
PowerShellCorpus/GithubGist/ranniery_65ea5b584599e198b967_raw_ce7d1ab889c7e259f43e729d1862c5d291312101_Generate-md5.ps1 | ranniery_65ea5b584599e198b967_raw_ce7d1ab889c7e259f43e729d1862c5d291312101_Generate-md5.ps1 | ###########################
# Ranniery Holanda #
# email@ranniery.com.br #
# @_ranniery #
# 07/08/2014 #
###########################
# Generate-md5.ps1 #
###########################
function Generate-md5
{
param(
[Parameter(Mandatory=$true)]
[... |
PowerShellCorpus/GithubGist/robie2011_0a21ecb52561d196d5fe_raw_a65e8e912ed9024dc33ee776731af4ff39df53e0_Install-SQL2008R2.ps1 | robie2011_0a21ecb52561d196d5fe_raw_a65e8e912ed9024dc33ee776731af4ff39df53e0_Install-SQL2008R2.ps1 | <#
.SYNOPSIS
Install SQL2008R2 Server
.DESCRIPTION
use Switches to install SQL Server Features easy and silently
.PARAMETER instanceName
Name of SQL Instance
.PARAMETER useGerman
Install German Version of SQL Server (Managementstudio)
.PARAMETER installOnly
Use this parameter to only install Ma... |
PowerShellCorpus/GithubGist/dfinke_5659023_raw_ff7086b971dfc46575b46489e0b96926f1545013_myise.ps1 | dfinke_5659023_raw_ff7086b971dfc46575b46489e0b96926f1545013_myise.ps1 | function MyISE {
param($File)
if(!(Test-path $File)) {
New-Item -name $File -itemtype "file"
}
ise $file
}
|
PowerShellCorpus/GithubGist/wictorwilen_e9baad3d405b2d790ad4_raw_bfa35b689bffaa4806b2340413fef4f4b917c804_secure-channel-logging.ps1 | wictorwilen_e9baad3d405b2d790ad4_raw_bfa35b689bffaa4806b2340413fef4f4b917c804_secure-channel-logging.ps1 | # http://support.microsoft.com/kb/260729
# 0x0000 0 Do not log
# 0x0001 1 Log error messages
# 0x0002 2 Log warnings
# 0x0004 4 Log informational and success events
Set-ItemProperty HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL -Name "EventLogging" -Value "4"
Write-Host -ForegroundC... |
PowerShellCorpus/GithubGist/ziembor_6978593_raw_f2eba8e0bf72a244cd089233d7919e7d76bad39e_zb-out-voice-lang-pl.ps1 | ziembor_6978593_raw_f2eba8e0bf72a244cd089233d7919e7d76bad39e_zb-out-voice-lang-pl.ps1 | function Out-Speech {param($text,$lang)
if($text -eq $null) {$text = 'null'}
if($lang -eq $null) {$lang = 'en-US'}
[Reflection.Assembly]::LoadWithPartialName('System.Speech') | Out-Null
$object = New-Object System.Speech.Synthesis.SpeechSynthesizer
$voices = $object.GetInstalledVoices()| select -ExpandProperty V... |
PowerShellCorpus/GithubGist/safwank_2939779_raw_149a7b17d18d62ca5abe8b67130611ad08eb58e0_InstanceSpinner.ps1 | safwank_2939779_raw_149a7b17d18d62ca5abe8b67130611ad08eb58e0_InstanceSpinner.ps1 | param([string]$operation, [string]$secretKeyId, [string]$secretAccessKeyId, [string[]]$instanceIds)
Add-Type -Path ".\AWSSDK.dll"
function StartInstances()
{
$ec2Client = CreateEC2Client
$request = New-Object -TypeName Amazon.EC2.Model.StartInstancesRequest
$request.InstanceId = GetInstancesFromParamete... |
PowerShellCorpus/GithubGist/nickdelany_b3c9d675ff2a0c295aa2_raw_ea9c4c78dab8d083b9462c2b736ca7a3bcd3090d_snippets.ps1 | nickdelany_b3c9d675ff2a0c295aa2_raw_ea9c4c78dab8d083b9462c2b736ca7a3bcd3090d_snippets.ps1 | # Powershell version
$PSVersionTable.psversion
# find files
get-childitem -recurse -include *pattern* | format-table Fullname
get-childitem -recurse -include *pattern* | select Fullname, length
# grep
select-string *file pattern* -pattern "text" [-CaseSensitive]
# wc -l
get-content *file pattern* | measur... |
PowerShellCorpus/GithubGist/omardelrio_6430400_raw_9a5462efb6722a01cc5f9c94663014775a2f416e_gistfile1.ps1 | omardelrio_6430400_raw_9a5462efb6722a01cc5f9c94663014775a2f416e_gistfile1.ps1 | # If Posh-Git environment is defined, load it.
if (test-path env:posh_git) {
. $env:posh_git
}
|
PowerShellCorpus/GithubGist/guitarrapc_e8daeb96abca368a7acf_raw_4797229b2bb8c43a2353922151949ea12cf866ed_New-Empty.ps1 | guitarrapc_e8daeb96abca368a7acf_raw_4797229b2bb8c43a2353922151949ea12cf866ed_New-Empty.ps1 | function New-Empty ([string]$type)
{
$def = @"
public static System.Collections.Generic.IEnumerable<$type> Empty()
{
System.Collections.Generic.IEnumerable<$type> empty = System.Linq.Enumerable.Empty<$type>();
return empty;
}
"@
try
{
$name = [guid]::NewGuid().Guid -replace '-',''
... |
PowerShellCorpus/GithubGist/justFen_2568488_raw_0b29733810856b045d30ae569a378288233cebd3_emailfunction.ps1 | justFen_2568488_raw_0b29733810856b045d30ae569a378288233cebd3_emailfunction.ps1 | $smtp = "nice.smtp.server.brok"
$from = "Test@Testing.com"
$to = "Self@DismantleRepair.me"
$subject = "Interesting subject~!"
$body = "Nice Curves!"
Send-Mailmessage -SmtpServer $smtp -From $from -To $to -Subject $subject -Body $body
|
PowerShellCorpus/GithubGist/iacosta_3169928_raw_1d349dda2ecca8cbad673e16ae6e145a8e07cfc0_gistfile1.ps1 | iacosta_3169928_raw_1d349dda2ecca8cbad673e16ae6e145a8e07cfc0_gistfile1.ps1 | #!/bin/bash
# Script de copias de seguridad (DATAPUMP) Base de datos
# Autor = IVAN ACOSTA
export PATH=$PATH:/usr/local/bin:/bin:/usr/bin
echo "***********************************************"
echo "*Backup Database Inicializando *"
echo "***********************************************"
echo "Fecha:`date "+%Y... |
PowerShellCorpus/GithubGist/knjname_33b3d390e870b9c4881e_raw_1b22885f62f3262b903b5249625ebbb73c57285b_UnderstandingPowerShellDynamicScope.ps1 | knjname_33b3d390e870b9c4881e_raw_1b22885f62f3262b903b5249625ebbb73c57285b_UnderstandingPowerShellDynamicScope.ps1 | $PSVersionTable
# Name Value
# ---- -----
# PSVersion 4.0 ... |
PowerShellCorpus/GithubGist/pekeq_6182948_raw_c539afa455a4425f0be936edc1d3b3b6a479336e_Fix-Combined-Character-FileName.ps1 | pekeq_6182948_raw_c539afa455a4425f0be936edc1d3b3b6a479336e_Fix-Combined-Character-FileName.ps1 | <#
.SYNOPSIS
ファイル名、ディレクトリ名のUNICODE結合文字を、普通の1文字に変換する
.DESCRIPTION
ファイル名、ディレクトリ名のUNICODE結合文字になっている部分を、普通の1文字に変換する。
例えば、「か + ゛(濁点記号)」を、「が」に変換する。
Macは、ファイル名をUNICODE結合文字で保存するが、Windowsは、普通の1文字で保存するので、
MacからWindowsに、USBメモリーでファイルをコピーした際など、MacとWindowsのファイル交換時に
問題が生じる。
Macからファイルをコピーしてきた後で、このスクリプトを動かして、ファイル名をWindow... |
PowerShellCorpus/GithubGist/rossnz_8519848_raw_d4d470ec26cf0a68e965a8e16c753e50943bb062_gistfile1.ps1 | rossnz_8519848_raw_d4d470ec26cf0a68e965a8e16c753e50943bb062_gistfile1.ps1 | PS> 'My phone number is 01-234-5678' -replace '[\d-]','#'
My phone number is ###########
|
PowerShellCorpus/GithubGist/philoushka_2a1e4cc5fa727c1bbcb7_raw_1098e126bc3cba8d586c5e74fbbee7c1e584ed6e_PoodleBlock.ps1 | philoushka_2a1e4cc5fa727c1bbcb7_raw_1098e126bc3cba8d586c5e74fbbee7c1e584ed6e_PoodleBlock.ps1 | $protocols = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols"
$sslVersionToDisable = 2,3
ForEach ($sslVersion in $sslVersionToDisable)
{
$sslSubkeyServer = "$protocols\SSL $sslVersion.0\Server"
Write-Host "Creating $sslSubkeyServer"
New-Item -Path $sslSubkeyServer -ItemType K... |
PowerShellCorpus/GithubGist/alienone_d65acdfea933f64de073_raw_f6e16f4b911dc005d0e7bc95f6e03678eacaf476_invoke_local_remote.ps1 | alienone_d65acdfea933f64de073_raw_f6e16f4b911dc005d0e7bc95f6e03678eacaf476_invoke_local_remote.ps1 | Function RunLocalRemote{
<#
Description: Run local PowerShell script asynchronous on remote systems
Input: CSV file
Output: PowerShell job
#>
$hostname = $env:computername
$username = "DOMAIN\USERNAME"
$password = "PASSWORD"
$securepassword = ConvertTo-SecureString -AsPla... |
PowerShellCorpus/GithubGist/MichaelPaulukonis_a75cf5d5b16627293014_raw_f9a58500d21cc67240efad057a9b7aba3b01873e_csv.export.ps1 | MichaelPaulukonis_a75cf5d5b16627293014_raw_f9a58500d21cc67240efad057a9b7aba3b01873e_csv.export.ps1 | $ErrorActionPreference="Stop"
if ($args.Count -le 2)
{
throw "Usage: <server name> <db name> <script file>"
}
$servername = $args[0]
$database = $args[1]
$sourcefile = $args[2]
[system.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
$server = New-Object ("Microsoft.S... |
PowerShellCorpus/GithubGist/abhishekkhaware_7152497_raw_245bf867b13ed127ebaa6ae850c1067828984709_gistfile1.ps1 | abhishekkhaware_7152497_raw_245bf867b13ed127ebaa6ae850c1067828984709_gistfile1.ps1 | # Open Powershell profile
## PS c:\> notepad $profile
# Add Path($PATH= C:\Program Files\Sublime Text 2\) to the System Envairoment Variable for easy access of Sublime_Text.exe
# Create a function for Sublime Text 2 or 3 in $profile
function sublime($arg1){ sublime_text.exe $arg1 }
# Now Create An Alias:
Set-Ali... |
PowerShellCorpus/GithubGist/vcaraulean_532094_raw_d44bd51335b9170c1d8923e1f47f8461e020c157_profile.ps1 | vcaraulean_532094_raw_d44bd51335b9170c1d8923e1f47f8461e020c157_profile.ps1 | Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
$profilePath = split-path $profile
# Load posh-git and posh-hg modules from default profile directory
Import-Module $profilePath\posh-git\posh-git
Import-Module $profilePath\posh-hg\posh-hg
function prompt {
Write-Host($pwd) -no... |
PowerShellCorpus/GithubGist/oxo42_7672630_raw_5a515d971ac1aee835b56e717001dc098da4bbca_gistfile1.ps1 | oxo42_7672630_raw_5a515d971ac1aee835b56e717001dc098da4bbca_gistfile1.ps1 | $resolutions = @{"640x960" = "640x960"; "640x1136" = "640x1136"; "960x544" = "960x544"; "1024x1024" = "1024x1024"; "2048x2048" = "2048x2048"; "1080x1920" = "1080x1920"; "1920x1080" = "1080p" }
$user = $args[0]
$password = $args[1]
$url = $args[2]
$ismatch = $url -match 'i=(.+)$'
if(!$ismatch)
{
exit
}... |
PowerShellCorpus/GithubGist/9to5IT_9621003_raw_ed51614d6fd021cb8b709b8ec17de1c638b0ad40_Encryption_Functions.ps1 | 9to5IT_9621003_raw_ed51614d6fd021cb8b709b8ec17de1c638b0ad40_Encryption_Functions.ps1 | Function Set-EncryptKey{
<#
.SYNOPSIS
Used to create an encryption \ decryption key
.DESCRIPTION
This function is used to create an encrytpion \ decryption key that will be used in conjunction with PowerShell cmdlets and functions to encrypt and decrypt data.
The key needs to be between 16 and 32 cha... |
PowerShellCorpus/GithubGist/VoiceOfWisdom_96e7f7cc91ec139c0e01_raw_d2bfb82e6785fba2227d3603cd13a375c98be050_gistfile1.ps1 | VoiceOfWisdom_96e7f7cc91ec139c0e01_raw_d2bfb82e6785fba2227d3603cd13a375c98be050_gistfile1.ps1 | "foo" | Set-Content helloworld.txt
hg add helloworld.txt
hg commit -m "added helloworld"
(Measure-Command { hg log -G -l 5 }).TotalSeconds
|
PowerShellCorpus/GithubGist/rossnz_8519809_raw_a500d64bc24f3a0edf81f511f262138cfdc42176_gistfile1.ps1 | rossnz_8519809_raw_a500d64bc24f3a0edf81f511f262138cfdc42176_gistfile1.ps1 | PS> '1,2,3,4,5,6,,,' -replace ','
123456
|
PowerShellCorpus/GithubGist/hapylestat_6230152_raw_8b182357937692570a5ad0e9a3ffd581d9abf3cb_template_ps-class.ps1 | hapylestat_6230152_raw_8b182357937692570a5ad0e9a3ffd581d9abf3cb_template_ps-class.ps1 |
#=================================as custom object
$<classname>_code={
function init(){
}
Export-ModuleMember -function init
}
$<classname>=new-module -ScriptBlock $<classname>_connect -AsCustomObject
#===============================insert as path of c# code
#Todo: add snip... |
PowerShellCorpus/GithubGist/MattDavies_f70f6cbf739d00557e4f_raw_e0ff36cf23aa412edf830fe95b8b907ed14bffaa_gistfile1.ps1 | MattDavies_f70f6cbf739d00557e4f_raw_e0ff36cf23aa412edf830fe95b8b907ed14bffaa_gistfile1.ps1 | workflow ScaleVMs
{
param(
[parameter(Mandatory=$true)]
[string]$VMNames,
[parameter(Mandatory=$true)]
[string]$VMSize
)
$subscriptionName = Get-AutomationVariable -Name "SubscriptionName"
$subscriptionID = Get-AutomationVariable -Name "SubscriptionID"
$certifi... |
PowerShellCorpus/GithubGist/bak-t_8163463_raw_ac02bf464cf0776141754ee5647527d066c41a04_Restore-DB.ps1 | bak-t_8163463_raw_ac02bf464cf0776141754ee5647527d066c41a04_Restore-DB.ps1 | Param (
[string]
[parameter(Mandatory=$true,
HelpMessage="Full path and file name of backup")]
[alias("bf")]
$BackupFile,
[string]
[parameter(Mandatory=$true,
HelpMessage="Name of the database to restore")]
[alias("d")]
$Database,
[string[]]
[parameter(Mandatory=$false,
HelpMessage="SQL Scr... |
PowerShellCorpus/GithubGist/jcpowermac_7916164_raw_edc26f6a35c0b62acda8d77d1cd6f55f5823a39c_copy_gz_from_esxi.ps1 | jcpowermac_7916164_raw_edc26f6a35c0b62acda8d77d1cd6f55f5823a39c_copy_gz_from_esxi.ps1 | Add-PSSnapin VMware.VimAutomation.Core
$basedir = "C:\Desktop\ESXTOP-04032012-130000\";
if( !(Test-Path $basedir) ){
New-Item -Type Directory $basedir
}
$datastores = Get-Datastore -VMHost (get-vmhost) | Where {$_.Name.Contains("-local") }
foreach( $ds in $datastores ) {
$newdir = $basedir ... |
PowerShellCorpus/GithubGist/johnrey1_8344393_raw_e62f4367006979111bd9f698501c6ec5dd894549_gistfile1.ps1 | johnrey1_8344393_raw_e62f4367006979111bd9f698501c6ec5dd894549_gistfile1.ps1 | #begin work C:\users\[YOURNAME]\desktop\awssecgroup.ps1 -rdp -mssql -setAws -accessKey "" -secretKey "" -region "us-west-1"
#end work C:\users\[YOURNAME]\desktop\awssecgroup.ps1 -revoke -rdp -mssql -setAws -accessKey "" -secretKey "" -region "us-west-1"
param(
[switch]$rdp,
[switch]$mssql,
[switch]$m... |
PowerShellCorpus/GithubGist/gioxx_0e97627257666bd40d81_raw_b8245f9088b4f9b834737526296ec75456b8f1ec_SalaRiunioni1-RipristinaDelegati.ps1 | gioxx_0e97627257666bd40d81_raw_b8245f9088b4f9b834737526296ec75456b8f1ec_SalaRiunioni1-RipristinaDelegati.ps1 | ############################################################################################################################
# OFFICE 365: Ripristino delegati Sala Riunioni 1
#----------------------------------------------------------------------------------------------------------------
# Autore: GSolone
# Vers... |
PowerShellCorpus/GithubGist/vors_4d96fb04fbe124c464eb_raw_d3e5223ffb0e45fbf540f46ce8d91e33136989d4_DelegatesGenerator.ps1 | vors_4d96fb04fbe124c464eb_raw_d3e5223ffb0e45fbf540f46ce8d91e33136989d4_DelegatesGenerator.ps1 | function Get-Action([int]$i)
{
'public delegate void Action<' + [string]::Join(", ", (1..$i | %{"in T$_"})) + '>(' + [string]::Join(", ", (1..$i | %{"T$_ arg$_"})) + ');'
}
function Get-Func([int]$i)
{
'public delegate TResult Func<' + [string]::Join(", ", (1..$i | %{"in T$_"})) + ', out TResult>(' + [... |
PowerShellCorpus/GithubGist/HowardvanRooijen_5008168_raw_ead9afad46696573d40ac3df106b7a38b5093e92_gistfile1.ps1 | HowardvanRooijen_5008168_raw_ead9afad46696573d40ac3df106b7a38b5093e92_gistfile1.ps1 | $parameters = @{
ConnectionDetails = @{
ServerUrl = "teamcity.codebetter.com"
Credential = Get-Credential
}
BuildConfigId = "bt437"
}
|
PowerShellCorpus/GithubGist/GrzegorzKozub_5361237_raw_7dc47945da65c096e4d69b45192839dcc07a1a27_Pull-VimBundleUpdates.ps1 | GrzegorzKozub_5361237_raw_7dc47945da65c096e4d69b45192839dcc07a1a27_Pull-VimBundleUpdates.ps1 | workflow Pull-VimBundleUpdatesInParallel {
$bundles = Get-ChildItem -Directory -Exclude "typescript-vim","vim-colors-solarized","vim-powerline"
foreach -parallel ($bundle in $bundles) {
InlineScript {
$bundle = $Using:bundle
Set-Location -Path $bundle.FullName
$... |
PowerShellCorpus/GithubGist/hansschmucker_f4031a37241d3d95e433_raw_eeb037c53747e0d7555123833399fa670c841644_c%23.ps1 | hansschmucker_f4031a37241d3d95e433_raw_eeb037c53747e0d7555123833399fa670c841644_c%23.ps1 | $opt = New-Object System.CodeDom.Compiler.CompilerParameters;
$opt.GenerateInMemory = $true;
$cr = [System.CodeDom.Compiler.CodeDomProvider]::CreateProvider("CSharp").CompileAssemblyFromSource($opt, "public class App { public static void Main() { "+ $input+" } }");
if($cr.CompiledAssembly){
$obj = $cr.CompiledAsse... |
PowerShellCorpus/GithubGist/hsmalley_3835269_raw_34d6f7b7c213dc568ae654d46aaffbcc3130ecdb_Deploy-Files.ps1 | hsmalley_3835269_raw_34d6f7b7c213dc568ae654d46aaffbcc3130ecdb_Deploy-Files.ps1 | # Get User/Pass
$Cred = Get-Credential
# Add Quest CMDLETS
Add-PSSnapin Quest.ActiveRoles.ADManagement -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
# Get Computer's from AD
$Computers = Get-QADComputer -SearchRoot "OU=Workstations,DC=Domain,DC=com" -Credential $Cred
# Import BITS for the file tra... |
PowerShellCorpus/GithubGist/stanleystl_5870540_raw_4fa5dc90e6b4c9d019ac651f588e1161788e86aa_block_ipaddr_failaudit.ps1 | stanleystl_5870540_raw_4fa5dc90e6b4c9d019ac651f588e1161788e86aa_block_ipaddr_failaudit.ps1 | $DT = [DateTime]::Now.AddDays(-1) # check only last 24 hours
$l = Get-EventLog -LogName 'Security' -InstanceId 4625 -After $DT | Select-Object @{n='IpAddress';e={$_.ReplacementStrings[-2]} } # select Ip addresses that has audit failure
$g = $l | group-object -property IpAddress | where {$_.Count -gt 20} | Select ... |
PowerShellCorpus/GithubGist/lantrix_c01d9235500072eaff9d_raw_25207e718460b3a1365912860491380e93602d5a_new_tag.ps1 | lantrix_c01d9235500072eaff9d_raw_25207e718460b3a1365912860491380e93602d5a_new_tag.ps1 | #get instances with specific tag
$tagFilter1 = New-Object Amazon.EC2.Model.Filter
$tagFilter1.Name = "tag:Environment Name"
$tagFilter1.Value.Add("MyEnv")
$instances = Get-EC2Instance -Filter @($tagFilter1)
#New or update tag on instances
foreach ($i in $instances.Instances) {
New-EC2Tag -ResourceId $i.Instance... |
PowerShellCorpus/GithubGist/adoprog_5605371_raw_04ce66ad6ea26d53cfcaf3065c9dec212bc19e59_gistfile1.ps1 | adoprog_5605371_raw_04ce66ad6ea26d53cfcaf3065c9dec212bc19e59_gistfile1.ps1 | task Compile {
exec { msbuild $buildFolder\Website\LaunchSitecore.sln /p:Configuration=Release /t:Clean }
exec { msbuild $buildFolder\Website\LaunchSitecore.sln /p:Configuration=Release /t:Build }
}
|
PowerShellCorpus/GithubGist/kmoormann_3800407_raw_fbcabc266c6c99d3b8994d83960a1464a083e71a_CombineFiles.ps1 | kmoormann_3800407_raw_fbcabc266c6c99d3b8994d83960a1464a083e71a_CombineFiles.ps1 | #http://www.brangle.com/wordpress/2009/08/combine-join-two-text-files-using-powershell/
|
PowerShellCorpus/GithubGist/timbodv_cb2d54a3bd0b0f0e3b1e_raw_8370bf7e7d9adeb2733783596e0ab918bf42a2ac_SampleSetMoeVersion.ps1 | timbodv_cb2d54a3bd0b0f0e3b1e_raw_8370bf7e7d9adeb2733783596e0ab918bf42a2ac_SampleSetMoeVersion.ps1 | param([string]$MOEVersion)
New-Item HKLM:SOFTWARE\MOE
New-ItemProperty HKLM:SOFTWARE\MOE -Name Version -Value "$MOEVersion"
$computerDetails = Get-WmiObject Win32_ComputerSystem
# clean up the manufacturer name
$manufacturer = $($computerDetails.Manufacturer)
$manufacturer = $manufacturer.Replace(" Inc.", "... |
PowerShellCorpus/GithubGist/opentable-devops_5979439_raw_36cb383494dac1b309a4254cc8657ee4dcaa7079_buildversion.ps1 | opentable-devops_5979439_raw_36cb383494dac1b309a4254cc8657ee4dcaa7079_buildversion.ps1 | param(
[string]$PATH_TO_BUILD_FOLDER = "",
[string]$BUILD_NUMBER = "")
try {
$doc = New-Object System.Xml.XmlDocument
$doc.Load("$PATH_TO_BUILD_FOLDER\AppSettings.config")
$BUILD = $doc.get_DocumentElement().SelectSingleNode("//add[@key='BuildNumber']")
$BUILD.value = $BUILD_NUMBER
$doc.Save("$P... |
PowerShellCorpus/GithubGist/aigarsdz_5575572_raw_2d2d6d02d6e135e9a698400c40a57a7ac36717cb_powershell-prompt.ps1 | aigarsdz_5575572_raw_2d2d6d02d6e135e9a698400c40a57a7ac36717cb_powershell-prompt.ps1 | function prompt {
$current_location = Get-Location
$home_pattern = $home -replace '\\', '\\'
$current_location = $current_location -replace $home_pattern, '~'
$current_dir = $current_location.split('\')[-1]
Write-Host " $([char]0x2192) " -foregroundcolor red -nonewline
Write-Host $curren... |
PowerShellCorpus/GithubGist/peaeater_9f5851028d51a5bc9c1c_raw_eead277de310c04d9a5562666d0eddb2781743e3_pdf2png.ps1 | peaeater_9f5851028d51a5bc9c1c_raw_eead277de310c04d9a5562666d0eddb2781743e3_pdf2png.ps1 | # convert pdf to png
# requires imagemagick w/ ghostscript
param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0)]
[ValidateScript({[System.IO.Path]::GetExtension($_) -eq ".pdf"})]
[string]$in
)
process {
$basePath = split-path $script:myinvocation.mycommand.path
$file... |
PowerShellCorpus/GithubGist/jokcofbut_5019850_raw_6e99134e2e796ce38b212adcdc73c1d061347e52_UpdateToLatestLiveVersionOfAPackage_Solution.ps1 | jokcofbut_5019850_raw_6e99134e2e796ce38b212adcdc73c1d061347e52_UpdateToLatestLiveVersionOfAPackage_Solution.ps1 | Update-Package -Id MyPackage -Source "MyRepo"
|
PowerShellCorpus/GithubGist/rismoney_1012af6cce0bd962f2f4_raw_3736c8a3139e43bc4fcf6e45b3d5f1afa96492cd_gistfile1.ps1 | rismoney_1012af6cce0bd962f2f4_raw_3736c8a3139e43bc4fcf6e45b3d5f1afa96492cd_gistfile1.ps1 | saw your post here-
#http://forums.iis.net/t/1200953.aspx?Modifying+advanced+application+settings+with+Powershell
#figured I would post this since I saw you were having an issue setting Citrix Director IIS settings via powershell.
get-webconfigurationproperty -PSPath "IIS:\Sites\Default Web Site\Direct... |
PowerShellCorpus/GithubGist/vgrem_fe0cda40b5ed0cd9070c_raw_7d4e3a721b1246ae295d17cb5c8b3755934ea106_Invoke-SPORestMethod.ps1 | vgrem_fe0cda40b5ed0cd9070c_raw_7d4e3a721b1246ae295d17cb5c8b3755934ea106_Invoke-SPORestMethod.ps1 | .\Get-SPOAccessToken.ps1
<#
.Synopsis
Sends an HTTP or HTTPS request to a SharePoint Online REST-compliant web service.
.DESCRIPTION
This function sends an HTTP or HTTPS request to a Representational State
Transfer (REST)-compliant ("RESTful") SharePoint Online web service.
.EXAMPLE
Invoke-SPOR... |
PowerShellCorpus/GithubGist/dfinke_3974322_raw_094711bd3d87e719e88e4bf7636d6e432b0de5ad_gistfile1.ps1 | dfinke_3974322_raw_094711bd3d87e719e88e4bf7636d6e432b0de5ad_gistfile1.ps1 |
var name = "System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
var asmName = new System.Reflection.AssemblyName(name);
var asm = System.Reflection.Assembly.Load(asmName);
|
PowerShellCorpus/GithubGist/BrunoCaimar_759716_raw_a487cd00a8051d6e5c9bac1df6e7e70e701d9239_UninstallGcx.ps1 | BrunoCaimar_759716_raw_a487cd00a8051d6e5c9bac1df6e7e70e701d9239_UninstallGcx.ps1 | #$a = "Gisconnex WM 1.0.2", "Gisconnex PD 1.0.11", "Gisconnex ADM 1.0.11"
$a = "Gisconnex WM 2.0.0", "Gisconnex PD 2.0.0", "Gisconnex ADM 2.0.0"
# Read-Host Para ler do prompt
# Write-Host Para escrever no prompt
$Keys = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall
$Items = $keys |... |
PowerShellCorpus/GithubGist/molsondry_6174083_raw_9acf2c70cb77d2c987cb325a14270050a348eb36_nikolaus.ps1 | molsondry_6174083_raw_9acf2c70cb77d2c987cb325a14270050a348eb36_nikolaus.ps1 | # Tage bis Nikolaus
cls
$nikolaus=New-Object System.DateTime(2011,12,6)
$today = Get-Date
$nikolausTag=$nikolaus.get_DayOfYear()
$todayTag=$today.get_DayOfYear()
Write-Host ("Es sind noch "+($nikolausTag-$todayTag)+" Tage bis Nikolaus")
#test
|
PowerShellCorpus/GithubGist/simonmichael_85b1139360d245d13f1b_raw_df6b371bb1bde2bcc13b3b66a5828e4ceaebbb33_gistfile1.ps1 | simonmichael_85b1139360d245d13f1b_raw_df6b371bb1bde2bcc13b3b66a5828e4ceaebbb33_gistfile1.ps1 | ~/src/hledger$ hledger balance -f data/sample.journal -p 'monthly from 2008 to 2008/7'
Balance changes in 2008h1:
|| 2008/01 2008/02 2008/03 2008/04 2008/05 2008/06
======================++=======================================================
assets:bank:checking || $1 ... |
PowerShellCorpus/GithubGist/zippy1981_1981612_raw_714b7708ed30df138f0e9cc2d9db913ac63b12c8_Foreach-Scope.ps1 | zippy1981_1981612_raw_714b7708ed30df138f0e9cc2d9db913ac63b12c8_Foreach-Scope.ps1 | $script:filename = ""
1..100 | % {
$script:filename = "$($env:temp)\deleteme-$($_).txt"
"Code: $(Get-Random 4-9)-$($_)"
} | Set-Content $script:filename
|
PowerShellCorpus/GithubGist/sukottosan_9747467_raw_25558c3fa8dc74b711fbacae955cb8771385ef9a_installedapps.ps1 | sukottosan_9747467_raw_25558c3fa8dc74b711fbacae955cb8771385ef9a_installedapps.ps1 | $InitialStartMode = Get-CimInstance -ClassName Win32_Service -Filter "Name = 'RemoteRegistry'" | Select-Object -ExpandProperty StartMode
Get-Service RemoteRegistry | Set-Service -StartupType Manual | Start-Service
$CurrentStartMode = Get-CimInstance -ClassName Win32_Service -Filter "Name = 'RemoteRegistry'" | Sel... |
PowerShellCorpus/GithubGist/davewilson_5612674_raw_fef4daaf5e7e6c223f853734bfe4f2ea523e1133_Play-Mario.ps1 | davewilson_5612674_raw_fef4daaf5e7e6c223f853734bfe4f2ea523e1133_Play-Mario.ps1 | Function Play-Mario {
[System.Console]::Beep(659, 125);
[System.Console]::Beep(659, 125);
[System.Threading.Thread]::Sleep(125);
[System.Console]::Beep(659, 125);
[System.Threading.Thread]::Sleep(167);
[System.Console]::Beep(523, 125);
[System.Console]::Beep(659, 125);
[System.Threading.Thread]::Sleep(1... |
PowerShellCorpus/GithubGist/stephengodbold_e01934fd093ed66249c5_raw_761947847b2588d899aa71dcc380be82021c569b_Set-LocalDevEnvironment.ps1 | stephengodbold_e01934fd093ed66249c5_raw_761947847b2588d899aa71dcc380be82021c569b_Set-LocalDevEnvironment.ps1 | #requires -version 2.0
param(
[Parameter(Mandatory = $true)]
[string]
$project,
[Parameter(Mandatory = $true)]
[string]
$hostname,
[Parameter(Mandatory = $true)]
[int]
$port,
[Parameter(Mandatory = $true)]
[ValidateSet('http', 'https')]
[s... |
PowerShellCorpus/GithubGist/anderssonjohan_5048127_raw_914559fa7dc5ec5febf2ce90c9dfc1bb45bec970_Setup-IIS.ps1 | anderssonjohan_5048127_raw_914559fa7dc5ec5febf2ce90c9dfc1bb45bec970_Setup-IIS.ps1 | param( $logsDirectory, $compressionDirectory )
$ScriptDir = $MyInvocation.MyCommand.Path | split-path
# https://github.com/remotex/Scripts/tree/master/Windows
Set-Alias enableFeature $ScriptDir\Enable-WindowsFeature.ps1
$wantedFeatures = @()
# install IIS Role
$wantedFeatures += "IIS-WebServerRole"
$wantedFeatures +=... |
PowerShellCorpus/GithubGist/victorvogelpoel_9328904_raw_a1fd899261cd0a5dc82b0e6c9e1c67607151fab4_Get-WSManCredSSPConfiguration.ps1 | victorvogelpoel_9328904_raw_a1fd899261cd0a5dc82b0e6c9e1c67607151fab4_Get-WSManCredSSPConfiguration.ps1 | # Get-WSManCredSSPConfiguration.ps1
# Compile a WSManCredSSP configuration object for the local or remote computer
# Inspired by http://www.ravichaganti.com/blog/?p=1902
# http://blog.victorvogelpoel.nl/2014/03/03/powershell-get-wsmancredsspconfiguration-getting-credssp-configuration-for-local-or-remote-computers/
... |
PowerShellCorpus/GithubGist/su324749_5030fd370ee79faca120_raw_a8177c1febd2ee021d18b089f9003697a1dff818_test.ps1 | su324749_5030fd370ee79faca120_raw_a8177c1febd2ee021d18b089f9003697a1dff818_test.ps1 |
# % gal -def foreach-object
#
# CommandType Name Definition
# ----------- ---- ----------
# Alias % ForEach-Object
# Alias foreach ForEach-Object
foreach ($i in ... |
PowerShellCorpus/GithubGist/jprescottsanders_8640185_raw_462b26b5126ac2a501aeffababb6f45b77f0734a_gistfile1.ps1 | jprescottsanders_8640185_raw_462b26b5126ac2a501aeffababb6f45b77f0734a_gistfile1.ps1 | # New dynamic distro
New-DynamicDistributionGroup -Name "Directors" -PrimarySmtpAddress "Directors@domain.com" -RecipientFilter {(Title -eq 'Director' -or Title -eq 'VP' -or Title -eq 'Executive VP') -and (samaccountname -ne 'person1' -and samaccountname -ne 'person2') }
# Check the members of a dynamic distro
$F... |
PowerShellCorpus/GithubGist/dfinke_4107451_raw_f2e3cb72ade529f7748d5e3f0838b549155b0639_GetAcquistion.ps1 | dfinke_4107451_raw_f2e3cb72ade529f7748d5e3f0838b549155b0639_GetAcquistion.ps1 | # http://developer.crunchbase.com/page
function Get-Acquisition {
param(
[Parameter(ValueFromPipeLine)]
$company = "facebook"
)
Process {
$url = "http://api.crunchbase.com/v/1/company/$($company).js"
(Invoke-RestMethod $url).acquisitions |
Selec... |
PowerShellCorpus/GithubGist/stefanstranger_2138dc710576bc40b64b_raw_bfd25a0e7363e9a1906908b0695ebcffaa508276_InstallMyTwitterModule.ps1 | stefanstranger_2138dc710576bc40b64b_raw_bfd25a0e7363e9a1906908b0695ebcffaa508276_InstallMyTwitterModule.ps1 | $webclient = New-Object System.Net.WebClient
$url = "https://github.com/MyTwitter/MyTwitter/archive/master.zip"
Write-Host "Downloading latest version of MyTwitter from $url" -ForegroundColor Cyan
$file = "$($env:TEMP)\MyTwitter.zip"
$webclient.DownloadFile($url,$file)
Write-Host "File saved to $file" -ForegroundC... |
PowerShellCorpus/GithubGist/urasandesu_2944313_raw_10dc3b74e14787b4d7a871b140dd60ea4aecdaf5_PowerShellAsLinq.ps1 | urasandesu_2944313_raw_10dc3b74e14787b4d7a871b140dd60ea4aecdaf5_PowerShellAsLinq.ps1 | # ----------------------------------------------------------------------------------------------------------
# PowerShell as LINQ
# * When I created this snippet, the blog written by NyaRuRu-san was very helpful.
# I would like to thank him for his article:
# - PowerShell で LINQ - NyaRuRuの日記: http://d.haten... |
PowerShellCorpus/GithubGist/marcusalmgren_2145630_raw_177d8d7f65455b7fc0520200f8525bdbbe51a12d_WPImageNameNormalize.ps1 | marcusalmgren_2145630_raw_177d8d7f65455b7fc0520200f8525bdbbe51a12d_WPImageNameNormalize.ps1 | # When you sync your images and videos from your Windows Phone to your computer, the files are
# annoyingly named using different conventions. For example, an image file will be named "WP_000123.jpg"
# and a video file "WP_yyyyMMdd_HHmmss.mp4". So, when viewing the files in Windows Explorer, it's
# unnecessarily ha... |
PowerShellCorpus/GithubGist/n-fukuju_8487308_raw_8e2470303ca1215cf395b971bd2d6433188c7118_progress.ps1 | n-fukuju_8487308_raw_8e2470303ca1215cf395b971bd2d6433188c7118_progress.ps1 | $header = @"
プログレスバーサンプル
"@
Write-Output $header
$loop = $true
while($loop){
$userInput = Read-Host "[1]一本バー [2]二本バー [3] とりあえず待機 [他]終了"
switch($userInput){
1{
# 一本バーサンプル
# -PercentCompleteは、0〜100で。(うっかり0.01〜1にすると、期待通りに動作しない)
foreach($i in (1..10)){
Write-Progress "サンプル" -Status "な... |
PowerShellCorpus/GithubGist/ploegert_b1919f0f31c544707bfc_raw_99e4a8bbbb8d003084338813e27773adafbc3a8a_PSRemote-CopyFiles.ps1 | ploegert_b1919f0f31c544707bfc_raw_99e4a8bbbb8d003084338813e27773adafbc3a8a_PSRemote-CopyFiles.ps1 | #Get the Remote URL
$uri = Get-AzureWinRMUri -ServiceName $AzureServiceName -Name $AzVM
srvuser = "DOMAIN\USER"
$srvpass = "Password"
#create the credential for the remote service
$log.debug("Creating credential for the Remote Session..")
$passwordCred = Convert... |
PowerShellCorpus/GithubGist/mwjcomputing_4688957_raw_cdbbb69b8e94c1044717795fd4c27a1247f17e80_Invoke-RestMethod.ps1 | mwjcomputing_4688957_raw_cdbbb69b8e94c1044717795fd4c27a1247f17e80_Invoke-RestMethod.ps1 | function Invoke-RestMethod {
[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=217034')]
param(
[Microsoft.PowerShell.Commands.WebRequestMethod]
${Method},
[Parameter(Mandatory=$true, Position=0)]
[ValidateNotNullOrEmpty()]
[uri]
${Uri},
[Microsoft.PowerShell.Comman... |
PowerShellCorpus/GithubGist/ryandanthony_dce72049b9edb56bb88e_raw_5faa2514a0fed3bad1549300e8cf39b9d3976c46_Octopus.Features.WindowsService_BeforePostDeploy.ps1 | ryandanthony_dce72049b9edb56bb88e_raw_5faa2514a0fed3bad1549300e8cf39b9d3976c46_Octopus.Features.WindowsService_BeforePostDeploy.ps1 | ## --------------------------------------------------------------------------------------
## Configuration
## --------------------------------------------------------------------------------------
$isEnabled = $OctopusParameters["Octopus.Action.WindowsService.CreateOrUpdateService"]
if (!$isEnabled -or ![Bool]::P... |
PowerShellCorpus/GithubGist/The13thDoc_0b3222d28d4fad2eb647_raw_6e52a5ca51b5ec08136a3c0771850832cf809b81_hello-world.ps1 | The13thDoc_0b3222d28d4fad2eb647_raw_6e52a5ca51b5ec08136a3c0771850832cf809b81_hello-world.ps1 | # Hello, World.
$hello = "Hello, World."
function say_hello
{
Write-Output $hello
}
say_hello
<#
If this is your first time running a Powershell (.ps1) script, you may have an issue
running the script due to default resrictions.
Type this into the shell:
Set-ExecutionPolicy RemoteSigned
#>
... |
PowerShellCorpus/GithubGist/mrcaron_6116039_raw_8e3008121d9a39c7eb22488b98ea379b44cc2902_PowershellSnippets.ps1 | mrcaron_6116039_raw_8e3008121d9a39c7eb22488b98ea379b44cc2902_PowershellSnippets.ps1 | # First N in file listing
function doSomething {}
ls $directory | select -first 10 | %{ &doSomething }
# Shutdown a list of machines with a name scheme of "machine-prefix-", numbered from 1-12
(0..12) | %{ shutdown -r -t 0 -f -m $("machine-prefix" + "{0:D2}" -f $_) }
|
PowerShellCorpus/GithubGist/fgarcia_7524015_raw_a7c8a42921e3ee9960351a4b24dbeae75536a5dc_gistfile1.ps1 | fgarcia_7524015_raw_a7c8a42921e3ee9960351a4b24dbeae75536a5dc_gistfile1.ps1 | #
# uncrustify config file for objective-c and objective-c++
#
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs
output_tab_size = 2 # new tab size
indent_columns = output_tab_size
indent_label = 2 # pos: absolute col, neg: relative column
indent_a... |
PowerShellCorpus/GithubGist/belotn_5405578_raw_2f78657c95f6de7c5a08b4c7fc32515e00196443_IISListIP.ps1 | belotn_5405578_raw_2f78657c95f6de7c5a08b4c7fc32515e00196443_IISListIP.ps1 | get-content "Path/To/File" |? { $_ -notlike "#[D,S-V]*"} |%{ @($_.Split(" "))[8] }|sort | group | select Name,Count,@{N='HostName',E={[system.net.dns]::GetHostEntry($_.Name}.HostName } }
|
PowerShellCorpus/GithubGist/vScripter_4cfa84960b3fc022d940_raw_54f374eb0f2426fcbf4144905d80ebcd4f2afa47_Add-PowerCLI.ps1 | vScripter_4cfa84960b3fc022d940_raw_54f374eb0f2426fcbf4144905d80ebcd4f2afa47_Add-PowerCLI.ps1 | <#
.DESCRIPTION
Load appropriate PowerCLI PSSnapins. These are based on PowerCLI 5.8 R1.
#>
[cmdletbinding()]
param()
PROCESS {
try {
Add-PSSnapin VMware.VimAutomation.Core
Add-PSSnapin VMware.VimAutomation.Vds
Add-PSSnapin VMware.VimAutomation.License
Add-PSSnapin VMware.DeployAutoma... |
PowerShellCorpus/GithubGist/takekazuomi_7946253_raw_dab56a5ad670d6fbc03f9d7b89bd23a37b13d345_xml.ps1 | takekazuomi_7946253_raw_dab56a5ad670d6fbc03f9d7b89bd23a37b13d345_xml.ps1 | $xml = [xml](Get-Content $config -Encoding UTF8)
$site = $xml.configuration."system.applicationHost".sites.site | where { $_.name -eq $siteName }
$site.application.virtualDirectory.SetAttribute("physicalPath", $applicationRoot)
$writer = New-Object System.XMl.XmlTextWriter($configSite, (New-Object System.Text.UT... |
PowerShellCorpus/GithubGist/CSGA-KPX_0e13b6fdb7962e70ad13_raw_128082e27f183b1ec951e17ccf405cf427550fad_main.ps1 | CSGA-KPX_0e13b6fdb7962e70ad13_raw_128082e27f183b1ec951e17ccf405cf427550fad_main.ps1 | Update-ExecutionPolicy Unrestricted
Move-LibraryDirectory "Personal" "Z:\KPX\Documents" -DoNotMoveOldContent
Move-LibraryDirectory "Desktop" "Z:\KPX\Desktop" -DoNotMoveOldContent
Move-LibraryDirectory "My Music" "Z:\KPX\Music" ... |
PowerShellCorpus/GithubGist/guitarrapc_ef302697e6c3e7fe1f51_raw_e4062285390c1db619ba48cea4dab7695c7f3aab_PowerShellClassScopeCheck.ps1 | guitarrapc_ef302697e6c3e7fe1f51_raw_e4062285390c1db619ba48cea4dab7695c7f3aab_PowerShellClassScopeCheck.ps1 | $d = 42 # Script scope
function bar
{
$d = 0 # Function scope
[MyClass]::DoSomething()
}
class MyClass
{
static [object] DoSomething()
{
return $d # error, not found dynamically
return $script:d # no error
$d = $script:d
return $d # no error, found l... |
PowerShellCorpus/GithubGist/GuruAnt_7215254_raw_26e9641e8f552edabe2791ee418754878d9b43c0_AddDrivePersistenceAsCustomAttribute.ps1 | GuruAnt_7215254_raw_26e9641e8f552edabe2791ee418754878d9b43c0_AddDrivePersistenceAsCustomAttribute.ps1 | $VCServerName = "MyVCServer"
$VC = Connect-VIServer $VCServerName
$SI = Get-View ServiceInstance
$CFM = Get-View $SI.Content.CustomFieldsManager
# Variables
$CustomFieldName = "HD Persistence"
$ManagedObjectType = "VirtualMachine"
# Check if the custom field already exists
$myCustomField = $CFM.Field | Wher... |
PowerShellCorpus/GithubGist/ctorx_574855_raw_0ccf27cc76cb785d2682330a152824b70eac92c3_ssh-agent-utils.ps1 | ctorx_574855_raw_0ccf27cc76cb785d2682330a152824b70eac92c3_ssh-agent-utils.ps1 | # SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy... |
PowerShellCorpus/GithubGist/michaelcoyote_9b0c285aa1b9afce6205_raw_bf22aaa579fd670951ef800ba19a957aee325cc8_Perf2CSV.ps1 | michaelcoyote_9b0c285aa1b9afce6205_raw_bf22aaa579fd670951ef800ba19a957aee325cc8_Perf2CSV.ps1 | # Quick & dirty PowerShell script for polling Windows PerfMon counters and dumping into a CSV file
# setup PowerShell internals
$1GBInBytes = 1GB
$Computer = $env:COMPUTERNAME
# Set the log destination directory
$LogDir="C:\MTGLogs\"
# Set the performance counters below
# customize as needed
$perfcounte... |
PowerShellCorpus/GithubGist/pkirch_dc4cd405c36e0d457776_raw_3ba0804ce703a06401a707bcea630440841823b4_Start-AzureVMSample.ps1 | pkirch_dc4cd405c36e0d457776_raw_3ba0804ce703a06401a707bcea630440841823b4_Start-AzureVMSample.ps1 | Start-AzureVM -ServiceName leasetest3 -Name host3
<# Output
OperationDescription OperationId OperationStatus
-------------------- ----------- ------... |
PowerShellCorpus/GithubGist/mkoertgen_2087bacda9cff0fa68aa_raw_ae6e52a49dda55a8ef6a2c762d5491bc3b183951_doc2pdf.ps1 | mkoertgen_2087bacda9cff0fa68aa_raw_ae6e52a49dda55a8ef6a2c762d5491bc3b183951_doc2pdf.ps1 | # cf.:
# - http://blog.coolorange.com/2012/04/20/export-word-to-pdf-using-powershell/
# - https://gallery.technet.microsoft.com/office/Script-to-convert-Word-f702844d
# http://blogs.technet.com/b/heyscriptingguy/archive/2013/03/24/weekend-scripter-convert-word-documents-to-pdf-files-with-powershell.aspx
param([s... |
PowerShellCorpus/GithubGist/GuruAnt_6bff34ad037275723969_raw_f07e1557e3ca44961ac1001c555a6f53893e539b_Restart-VirginRouter.ps1 | GuruAnt_6bff34ad037275723969_raw_f07e1557e3ca44961ac1001c555a6f53893e539b_Restart-VirginRouter.ps1 | function Restart-VirginRouter {
<#
.Synopsis
Restarts a Virgin Media Suberhub.
.Description
Restarts a Virgin Media Suberhub using the web interface.
.Parameter RouterIP
The IP address of the router.
.Parameter Username
The username used to log into the web interf... |
PowerShellCorpus/GithubGist/litodam_6829698_raw_252a0a68a7700beaace18381d662f0889f30caf5_AzurePublish.ps1 | litodam_6829698_raw_252a0a68a7700beaace18381d662f0889f30caf5_AzurePublish.ps1 | #NOTE: This script is based on the Microsoft provided guidance example at
# https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/.
Param(
[parameter(Mandatory=$true)]
$serviceName,
[parameter(Mandatory=$true)]
$storageAccountName,
[parameter(Mandatory=$true)]
... |
PowerShellCorpus/GithubGist/mcollier_10097074_raw_02094b75de5007601f4a2890344f6a05a33bf5c5_conference_downloads.ps1 | mcollier_10097074_raw_02094b75de5007601f4a2890344f6a05a33bf5c5_conference_downloads.ps1 | Param
(
[Parameter(Mandatory=$true)]
[String]
$DownloadLocation
)
cls
# The script has been tested on Powershell 3.0
Set-StrictMode -Version 3
# Following modifies the Write-Verbose behavior to turn the messages on globally for this session
$VerbosePreference = "Continue"
... |
PowerShellCorpus/GithubGist/sayedihashimi_f1fdc4bfba74d398ec5b_raw_1b7eaed5c17ba71c5e5df2c36c9fc43acb16f947_transform-xml.ps1 | sayedihashimi_f1fdc4bfba74d398ec5b_raw_1b7eaed5c17ba71c5e5df2c36c9fc43acb16f947_transform-xml.ps1 | <#
.SYNOPSIS
You can use this script to easly transform any XML file using XDT.
To use this script you can just save it locally and execute it. The script
will download it's dependencies automatically.
#>
[cmdletbinding()]
param(
[Parameter(
Mandatory=$true,
Position=0)]
$... |
PowerShellCorpus/GithubGist/myokoym_5891297_raw_c8dc9e93960166b49c27823e82505d6e0fc184bd_closing_times.ps1 | myokoym_5891297_raw_c8dc9e93960166b49c27823e82505d6e0fc184bd_closing_times.ps1 | for ($day = 1; $day -le 30; $day++) {
$start_time = New-Object System.DateTime 2013,6,$day,0,0,0,0
$end_time = New-Object System.DateTime 2013,6,$day,23,59,59,0
Get-EventLog System -After $start_time -Before $end_time -Newest 1
}
|
PowerShellCorpus/GithubGist/themightyshiv_6176508_raw_8996fa7d3488cd3e88ef01dd776fd2ca4b4fbb77_Simple-Mail-Bomber.ps1 | themightyshiv_6176508_raw_8996fa7d3488cd3e88ef01dd776fd2ca4b4fbb77_Simple-Mail-Bomber.ps1 | # Simple Mail-Bomber for PowerShell 2.0
# [By]: TheMightyShiv | [GitHub]: https://github.com/themightyshiv
# Global Variables
$PSEmailServer = 'smtp.server.com'
$MsgFrom = 'spoofed@email.com'
$MsgTo = 'victim@email.com'
$MsgSubject = 'Subject Here'
$MsgBody = 'Body Here'
$MsgLimit = 20
$MsgDelay = 1
# Whi... |
PowerShellCorpus/GithubGist/johnkattenhorn_cc77c268a713a029aa15_raw_f6621edf432665c0d1ec7a0c50be02990a25476b_TestSQL2014Express.ps1 | johnkattenhorn_cc77c268a713a029aa15_raw_f6621edf432665c0d1ec7a0c50be02990a25476b_TestSQL2014Express.ps1 | # Boxstarter options
$Boxstarter.RebootOk=$false # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot
# Install SQL Server 2014 Express and Tools (Neither seem to work with Boxstarter Remo... |
PowerShellCorpus/GithubGist/jstangroome_1955747_raw_7d155b841d7c52366d1321bfb8fea1a985f2f56b_Add-PSModulePath.ps1 | jstangroome_1955747_raw_7d155b841d7c52366d1321bfb8fea1a985f2f56b_Add-PSModulePath.ps1 | [CmdletBinding()]
param (
[string]
$Path
)
if (-not $Path -and $MyInvocation.ScriptName) {
$Path = Join-Path -Path ($MyInvocation.ScriptName | Split-Path) -ChildPath Modules
}
if (-not $Path -or -not (Test-Path -Path $Path -PathType Container)) {
throw "$($MyInvocation.MyCommand): Path requ... |
PowerShellCorpus/GithubGist/so0k_a4b702bd5196732dd428_raw_4290038830350a1d7cda36a2021e4a076c61056b_Build-DockerContainers.ps1 | so0k_a4b702bd5196732dd428_raw_4290038830350a1d7cda36a2021e4a076c61056b_Build-DockerContainers.ps1 | Param(
[switch]$keepalive
)
#region script config
$dockerhost = "localdocker"
$User = "docker"
$PWord = (new-object System.Security.SecureString) #this is how you define blank password
$keyfile = "C:\Path\To\keys"
#endregion
function isAlive($hostName){
Test-Connection -ComputerNam... |
PowerShellCorpus/GithubGist/ammonium_1694518_raw_d4482de955574b2d0eec0a8bafcc3c3df24fe847_file_change_notify_to_ftp.ps1 | ammonium_1694518_raw_d4482de955574b2d0eec0a8bafcc3c3df24fe847_file_change_notify_to_ftp.ps1 | #
# Watch for files in $watchDir that a match a filer $watchFilter
# and upload them to FTP $ftpUrl when they are changed (modified)
#
$ftpUrl = "ftp://username:password@example.com/pub/incoming/"
$watchDir = "C:\temp"
$watchFilter = "*.txt"
function uploadFile($fullFileName)
{
$webclient = New-Object System.N... |
PowerShellCorpus/GithubGist/alexblunck_8cb58f20dc366782f434_raw_4fc84ff3cd807c0cf9651b0ca3c9d562d094faca_gistfile1.ps1 | alexblunck_8cb58f20dc366782f434_raw_4fc84ff3cd807c0cf9651b0ca3c9d562d094faca_gistfile1.ps1 | # Computer Terminal
# A computer terminal in the original sense is hardware to
# enter data into, and display data from a computer, e.g.
# a server.
# Terminal Emulator
# A terminal emulator allows the usage of a "Computer Terminal"
# from a graphical user interface. An example would be the
# Terminal.app on Mac OS X... |
PowerShellCorpus/GithubGist/pkskelly_95b696e2a7df133ffa0d_raw_d35d133ac4ad0408153222d1e87564c7ebf51d46_Clear-SPListItems.ps1 | pkskelly_95b696e2a7df133ffa0d_raw_d35d133ac4ad0408153222d1e87564c7ebf51d46_Clear-SPListItems.ps1 | # =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Script: Clear-SPListItems.ps1
#
# Author: Pete Skelly
# Twitter: ThreeWillLabs
# http://www.threewill.com
#
# Description: Purge list in Sharepoint Online - Office 365 using CSOM by
# bat... |
PowerShellCorpus/GithubGist/nzthiago_5736907_raw_9a3278b01d7df07882bf9d444cad5974b0c834fb_download.ps1 | nzthiago_5736907_raw_9a3278b01d7df07882bf9d444cad5974b0c834fb_download.ps1 | [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
#Set the username for windows auth proxy
#$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/TechEd/NorthA... |
PowerShellCorpus/GithubGist/janikvonrotz_7086582_raw_6466258d0fcb5c771711d78dcea224c806d4441e_ImageFilterSliceAndMontage.ps1 | janikvonrotz_7086582_raw_6466258d0fcb5c771711d78dcea224c806d4441e_ImageFilterSliceAndMontage.ps1 |
# tmpdir=tmp
$TempFolder = "Slices"
$Output = "out.png"
$Filter = "*.png"
# if [ -d "$tmpdir" ]; then
# rm -rf $tmpdir
# fi
# mkdir $tmpdir
If(-not (Test-Path $TempFolder)){New-Item -Path $TempFolder -ItemType Directory}
# height=1080
$Height = 1080
# width=96
$Width = 96
# n=0
$N = 0
# for... |
PowerShellCorpus/GithubGist/jcpowermac_7915035_raw_b53a04c6151d40174f2ae9e38081b1cfe764e326_fixdvsbug.ps1 | jcpowermac_7915035_raw_b53a04c6151d40174f2ae9e38081b1cfe764e326_fixdvsbug.ps1 |
function Set-PortIdAdvanced {
Param([object] $VmView, [object] $PortId )
$netdev = ($VmView.Config.Hardware.Device | Where {$_.MacAddress})
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.deviceChange = New-Object VMware.Vim.VirtualDeviceConfigSpec[] (1)
$spec.deviceCh... |
PowerShellCorpus/GithubGist/paully21_9993683_raw_6cf7fb694e80d2bdb880c4650d1f1d5b197e221f_downloadBuild2014Videos.ps1 | paully21_9993683_raw_6cf7fb694e80d2bdb880c4650d1f1d5b197e221f_downloadBuild2014Videos.ps1 | [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2014/RSS/mp4high"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $_.title.Rep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.