full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/GithubGist/wurmr_9843120_raw_b3043cf86ab1a6d63c9b92cb49758836dec39d66_sqlDeploy.ps1 | wurmr_9843120_raw_b3043cf86ab1a6d63c9b92cb49758836dec39d66_sqlDeploy.ps1 | function Get-MSWebDeployInstallPath()
{
return (get-childitem "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" | Select -last 1).GetValue("InstallPath")
}
function Load-Configuration
{
$webDeploy = Get-MSWebDeployInstallPath
$env:Path += (";" + $webDeploy)
}
try
{
Load-Configuration
$Depacs = ... |
PowerShellCorpus/GithubGist/NotMyself_b184fa4e9ac010b26302_raw_0aea1a4f22fdf8191a56c3b567d47a2833f2b071_gistfile1.ps1 | NotMyself_b184fa4e9ac010b26302_raw_0aea1a4f22fdf8191a56c3b567d47a2833f2b071_gistfile1.ps1 | $dir = 'c:\exports\'
$years = @{ 2013=18 } #;2014=19;2012=17; 2011=16; 2010=15; 2009=14; 2008=13; 2007=12; 2006=11
$domains = @("MSPHSPE", "EOC", "WAAS", "WELPA") #"MSPHSPE", "EOC", "WAAS", "WELPA", "AYP"
$years.Keys | % {
$path = "$dir$_\"
if((Test-Path -Path $path)) {
Remove-Item -Recurse -Fo... |
PowerShellCorpus/GithubGist/chgeuer-duplicate_1054674_raw_5e8fc7b4ff6e0430175ca74ff36577a18d0a0b76_Download-SysInternals.ps1 | chgeuer-duplicate_1054674_raw_5e8fc7b4ff6e0430175ca74ff36577a18d0a0b76_Download-SysInternals.ps1 | $currentDir = (Get-Location -PSProvider FileSystem).ProviderPath
function InstallSysInternalsComponent([System.String] $filename, [System.String] $RegistryName)
{
$binaryDir = (Get-Location -PSProvider FileSystem).ProviderPath + [System.IO.Path]::DirectorySeparatorChar
# [HKEY_CURRENT_USER\Software\Sysintern... |
PowerShellCorpus/GithubGist/hapylestat_9b1fc3947e717701454d_raw_ef0db275b69e844fe766c7987c81737ab345913a_mount_drive.ps1 | hapylestat_9b1fc3947e717701454d_raw_ef0db275b69e844fe766c7987c81737ab345913a_mount_drive.ps1 | ################################################
# Map shares #
# Author: H.L. #
# Version: 0.3 #
# Description: map shares to the system #
################################################
##################... |
PowerShellCorpus/GithubGist/chrisfrancis27_5151297_raw_58e1015b92523f2632328ebbbb72fe2fd65e1484_profile.ps1 | chrisfrancis27_5151297_raw_58e1015b92523f2632328ebbbb72fe2fd65e1484_profile.ps1 | # '##::::'##::::'###::::'########::'####::::'###::::'########::'##:::::::'########::'######::
# ##:::: ##:::'## ##::: ##.... ##:. ##::::'## ##::: ##.... ##: ##::::::: ##.....::'##... ##:
# ##:::: ##::'##:. ##:: ##:::: ##:: ##:::'##:. ##:: ##:::: ##: ##::::::: ##::::::: ##:::..::
# ##:::: ##:'##:::. ##: ########::... |
PowerShellCorpus/GithubGist/rheid_ac43862993666947a008_raw_bfb12b4cba5a26d0edde0a863d43cb0d2ecf4d5a_unpublischoct.ps1 | rheid_ac43862993666947a008_raw_bfb12b4cba5a26d0edde0a863d43cb0d2ecf4d5a_unpublischoct.ps1 | Add-PSSnapIn Microsoft.SharePoint.PowerShell
if ($args.Count -ne 3)
{
Write-Host "UnpublishContentTypes.ps1 <web url> <content type hub url> <unpublish>"
exit
}
$webUrl = $args[0]
$ctUrl = $args[1]
$unpublish = $args[2]
$web = Get-SPWeb $webUrl
$ctsite = Get-SPSite $ctUrl
$ctPublishe... |
PowerShellCorpus/GithubGist/giseongeom_5432994_raw_bdc56b34e7b5ce66c0067cec007d876d51ebc183_payA.ps1 | giseongeom_5432994_raw_bdc56b34e7b5ce66c0067cec007d876d51ebc183_payA.ps1 | [CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[int]$A
)
[int]$C1 = 0
[int]$C5 = 0
[int]$C10 = 0
[int]$C50 = 0
[int]$C100 = 0
[int]$C500 = 0
[int]$CAll = 0
[int]$tmp = 0
$C500 = ( $A / 500 ) ; $tmp = ( $A % 500 )
if ( $tmp -ne 0 ) { $C100 = ( $tmp / 100 ) ; $tmp ... |
PowerShellCorpus/GithubGist/onyxhat_2c02749d4891c303506e_raw_8277a3f3f5e8ffd7ed6cc83ae3fcf4466130b295_Mirror-DB.ps1 | onyxhat_2c02749d4891c303506e_raw_8277a3f3f5e8ffd7ed6cc83ae3fcf4466130b295_Mirror-DB.ps1 | param ([string]$SrcDBInstance, [string]$DestDBInstance, [string]$DBName)
#Functions
function Exec-Query ([string]$DBServer,[string]$DBName,[string]$Query) {
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server=$DBServer;Database=$DBName;Integrated Secur... |
PowerShellCorpus/GithubGist/grenade_7749144_raw_a7e7fe242cfeacfb4d5d3ac59b149cd086f5759d_wmi-firewall-exceptions.ps1 | grenade_7749144_raw_a7e7fe242cfeacfb4d5d3ac59b149cd086f5759d_wmi-firewall-exceptions.ps1 | # http://msdn.microsoft.com/en-us/library/jj980508(v=winembedded.81).aspx
# http://wiki.splunk.com/Deploy:HOWTO_Enable_WMI_Access_for_Non-Admin_Domain_Users
# http://blogs.technet.com/b/ashleymcglone/archive/2011/04/18/powershell-remoting-exposed-how-to-command-your-minions.aspx
# disable Remote UAC:
reg add HKLM... |
PowerShellCorpus/GithubGist/johnsocp_6127196_raw_8a05cddbb3df221c410185fd79a36f9f329fb5bc_gistfile1.ps1 | johnsocp_6127196_raw_8a05cddbb3df221c410185fd79a36f9f329fb5bc_gistfile1.ps1 | Import-Module SPModule.misc
Import-Module SPModule.setup
Install-SharePoint -SetupExePath "c:\SP210" -ServerRole "SINGLESERVER"
|
PowerShellCorpus/GithubGist/HarmJ0y_4c37e43ba4865bdef2a8_raw_b916a8a85488ea85a0021b43aa58698e8ad15324_psremoting.ps1 | HarmJ0y_4c37e43ba4865bdef2a8_raw_b916a8a85488ea85a0021b43aa58698e8ad15324_psremoting.ps1 | #Run winrm quickconfig defaults
echo Y | winrm quickconfig
#Run enable psremoting command with defaults
Enable-PSRemoting -force
# adjust local token filter policy
Set-ItemProperty –Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System –Name LocalAccountTokenFilterPolicy –Value 1 -Type DWord
... |
PowerShellCorpus/GithubGist/nims_4263820_raw_031b81ae6cdd2c1b1b9cf571fa1a5983f0e6ddd5_readSite.ps1 | nims_4263820_raw_031b81ae6cdd2c1b1b9cf571fa1a5983f0e6ddd5_readSite.ps1 | $result = (new-object System.IO.StreamReader ([System.Net.WebRequest]::Create("URL_of_Site").GetResponse().GetResponseStream())).ReadToEnd()
|
PowerShellCorpus/GithubGist/trondhindenes_087a706421ffa6c945d5_raw_87100221b82008818bee2b03f5d63f6d3c55e774_win_restart.ps1 | trondhindenes_087a706421ffa6c945d5_raw_87100221b82008818bee2b03f5d63f6d3c55e774_win_restart.ps1 | #!powershell
# This file is part of Ansible.
#
# Copyright 2014, Trond Hindenes <trond@hindenes.com> and others
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... |
PowerShellCorpus/GithubGist/PaulStovell_9c4c72602ebe1b76942e_raw_3730914d329958a9163eab41a6fd53bd4ee569ac_gistfile1.ps1 | PaulStovell_9c4c72602ebe1b76942e_raw_3730914d329958a9163eab41a6fd53bd4ee569ac_gistfile1.ps1 | # Create arguments as an array
$args = @("create-release", "--project", "My Project")
# Dynamically add arguments
$environments = @("My Environment", "Production")
foreach ($environment in $environments)
{
$args += "--environment"
$args += $environment.Trim()
}
& .\Octo.exe ($args)
|
PowerShellCorpus/GithubGist/sjwaight_f81771e365877ee1dc39_raw_3e9c0cefa9b3ea4c782544ecf49dbcfc479206e1_04-Setup-TrafficManager.ps1 | sjwaight_f81771e365877ee1dc39_raw_3e9c0cefa9b3ea4c782544ecf49dbcfc479206e1_04-Setup-TrafficManager.ps1 |
# You can download this file as part of this repository: https://github.com/sjwaight/uha-azure-sample/
if($args.Count -eq 0)
{
Write-Host "ERROR: you must supply a unique traffic manager DNS prefix"
Exit 1
}
$tmDomain = "{0}.trafficmanager.net" -f $args[0]
$trafficManProfile = New-AzureTrafficMan... |
PowerShellCorpus/GithubGist/mdumrauf_7593409_raw_db02ddb3a391ef51748c53ab9631c640e2ca16cb_db_multiverse_downloader.ps1 | mdumrauf_7593409_raw_db02ddb3a391ef51748c53ab9631c640e2ca16cb_db_multiverse_downloader.ps1 | echo "Downlading.."
$file = ""
$client = new-object System.Net.WebClient
for($i = 1; $i -le 797; $i++)
{
if ($i -lt 10) { $file = "000$($i)" }
elseif (($i / 10) -lt 10) { $file = "00$($i)" }
elseif (($i / 100) -lt 100) { $file = "0$($i)" }
Try {
$client.DownloadFile("http://www.dragonball-multiv... |
PowerShellCorpus/GithubGist/tiernano_3798509_raw_12eaefa066f55af1b8c750ef516dc79b88ab4f63_convert-to-AppleTV.ps1 | tiernano_3798509_raw_12eaefa066f55af1b8c750ef516dc79b88ab4f63_convert-to-AppleTV.ps1 | $files = gci "path to your file location"
$handbrake = "C:\Program Files\HandBrake\HandBrakeCLI.exe"
foreach($file in $files) {
$newFileName = "path to where you want the files to be set to..." + [System.IO.Path]::GetFileNameWithoutExtension($file) + ".m4v"
& $handbrake -i $file.FullName -o $newFileName --preset ... |
PowerShellCorpus/GithubGist/RhysC_840623_raw_84a07b78be89af7e1d485fce30b521d8d51d7ae5_cleanSvn.ps1 | RhysC_840623_raw_84a07b78be89af7e1d485fce30b521d8d51d7ae5_cleanSvn.ps1 | function cleanSvn {
param ([string]$path)
write-host "Cleaning svn from: $path"
get-childitem $path -include .svn -recurse -force | remove-item -force -confirm:$false -recurse
}
|
PowerShellCorpus/GithubGist/Touichirou_a8fe9b9bec77892c13de_raw_3b5562b1e5da3e1eab14252a23df06c78b2f8f7b_change-windows-password-policy.ps1 | Touichirou_a8fe9b9bec77892c13de_raw_3b5562b1e5da3e1eab14252a23df06c78b2f8f7b_change-windows-password-policy.ps1 | # Export LocalSecurityPolicy.cfg
& SecEdit.exe /export /cfg .\LocalSecurityPolicy.cfg
Get-Item -Path ".\LocalSecurityPolicy.cfg"
& notepad.exe .\LocalSecurityPolicy.cfg
# Import LocalSecurityPolicy.cfg after changing
& SecEdit.exe /configure /db .\LocalSecurityPolicy.db /cfg .\LocalSecurityPolicy.cfg
Get-Item -... |
PowerShellCorpus/GithubGist/Kruzen_9143261_raw_f7b10a12e363971a94c35f203d01d66f61801f76_Generate-GUID.ps1 | Kruzen_9143261_raw_f7b10a12e363971a94c35f203d01d66f61801f76_Generate-GUID.ps1 | $Members = @("PC1","PC2","PC3","PC4","PC5")
$CostCenter = "50"
Function GenerateID($Members,$CostCenter){
$IDPool = (20..(20+$Members.count - 1) | %{$_.ToString("$($CostCenter)0000")})
foreach($member in $Members){
$Object = New-Object PSObject -Property @{
PCID = $Members[(0..($Members.Count - 1)... |
PowerShellCorpus/GithubGist/venetianthief_7d9af24d76810f301b7a_raw_d99c14878535bdc8d07109cc24ff330ebbab1cff_mongodb-install.ps1 | venetianthief_7d9af24d76810f301b7a_raw_d99c14878535bdc8d07109cc24ff330ebbab1cff_mongodb-install.ps1 | # Borrowed from: http://blogs.msdn.com/b/jasonn/archive/2013/06/11/8594493.aspx
function downloadFile($url, $targetFile) {
$uri = New-Object "System.Uri" "$url"
$request = [System.Net.HttpWebRequest]::Create($uri)
$request.set_Timeout(15000) #15 second timeout
$response = $request.GetResponse()
$total... |
PowerShellCorpus/GithubGist/richjenks_6548962_raw_e5fab68aba6b4e0451945dd4fb5d70d27e4fc27e_full-path-file-type.ps1 | richjenks_6548962_raw_e5fab68aba6b4e0451945dd4fb5d70d27e4fc27e_full-path-file-type.ps1 | gci -r | where {$_.extension -match ".html|.htm|.php|.asp"} | select FullName
|
PowerShellCorpus/GithubGist/nopslider_0b32b15d59cd5a9b56a2_raw_081002f67f89d2acbcf0ca15a30f4a82bc3c9dec_gistfile1.ps1 | nopslider_0b32b15d59cd5a9b56a2_raw_081002f67f89d2acbcf0ca15a30f4a82bc3c9dec_gistfile1.ps1 | Get-ADUser -Filter * -properties * | Export-csv domain.csv
|
PowerShellCorpus/GithubGist/guitarrapc_cfff0c9fc907e95dd6d8_raw_3b57e0ce024171d90891d351be5f575e40ff6ac5_bashStyle.ps1 | guitarrapc_cfff0c9fc907e95dd6d8_raw_3b57e0ce024171d90891d351be5f575e40ff6ac5_bashStyle.ps1 | #2. ${} でくくる。これもプロパティ指定がだめ (in-line評価 => bash スタイル)
"${hoge}"
"${fuga}"
|
PowerShellCorpus/GithubGist/CapsAdmin_c33b41c6642e4338bb7a_raw_a88ea870f51a3436c67f48c0130d0b421a130474_gistfile1.ps1 | CapsAdmin_c33b41c6642e4338bb7a_raw_a88ea870f51a3436c67f48c0130d0b421a130474_gistfile1.ps1 | #download zip file and extract specific directory with powershell
$url = "https://github.com/CapsAdmin/rpg_hitmarks/archive/master.zip"
$folder_in_zip = "rpg_hitmarks-master\lua"
$output_folder = $PSScriptRoot + "\windows_lol"
function download()
{
if(!(Test-Path $output_folder)) {New-Item -ItemType director... |
PowerShellCorpus/GithubGist/andrerocker_655819_raw_b13a888bc8cdf142eba5c15f8b11a6cc9a33d971_sqlserver-dump-only-data.ps1 | andrerocker_655819_raw_b13a888bc8cdf142eba5c15f8b11a6cc9a33d971_sqlserver-dump-only-data.ps1 | $database_host = "<host>"
$database_name = "<database>"
$output_file = "<output_file>"
$user = "<username>"
$password = "<password>"
[system.reflection.assembly]::loadWithPartialName('Microsoft.SqlServer.SMO')
$server = new-object "Microsoft.SqlServer.Management.Smo.Server" $database_host
$server.connectionContext.l... |
PowerShellCorpus/GithubGist/glombard_516c83ef97a7ad354db1_raw_e38d9d3ae10056eb8fb908e32f09731ae9678f00_set-npm-vs-version.ps1 | glombard_516c83ef97a7ad354db1_raw_e38d9d3ae10056eb8fb908e32f09731ae9678f00_set-npm-vs-version.ps1 | # See: https://www.npmjs.org/package/node-gyp
$vsVersion = "2012"
if (Test-Path HKLM:\Software\Microsoft\VisualStudio\12.0) {
$vsVersion = "2013"
}
npm.cmd config set msvs_version $vsVersion
|
PowerShellCorpus/GithubGist/jonschoning_5447741_raw_1e34b3fd80bbfa30231822d07009f4d2666ef52f_remote-exec-iis.ps1 | jonschoning_5447741_raw_1e34b3fd80bbfa30231822d07009f4d2666ef52f_remote-exec-iis.ps1 | $Session = New-PSSession -ComputerName '<ComputerName>'
$block = {
import-module 'webAdministration'
# Call IIS cmdlets here for adding app pools, creating web site and so on
}
Invoke-Command -Session $Session -ScriptBlock $block
|
PowerShellCorpus/GithubGist/bgallagh3r_3535856_raw_1f09b634e99e7ddb67069abee6297630cc666e93_profile.ps1 | bgallagh3r_3535856_raw_1f09b634e99e7ddb67069abee6297630cc666e93_profile.ps1 | # My preferred prompt for Powershell.
# Displays git branch and stats when inside a git repository.
# See http://gist.github.com/180853 for gitutils.ps1.
. (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1)
function prompt {
$path = ""
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions... |
PowerShellCorpus/GithubGist/jlattimer_cb2f0d7e80d06ba73f10_raw_dd6dbcea355ec194d9c229a74a9ce098222fc416_Create%20CRM%20VM%20Static%20IP%20New.ps1 | jlattimer_cb2f0d7e80d06ba73f10_raw_dd6dbcea355ec194d9c229a74a9ce098222fc416_Create%20CRM%20VM%20Static%20IP%20New.ps1 | <# Make sure you have installed the Azure PowerShell cmdlets: https://www.windowsazure.com/en-us/manage/downloads/ and then reboot #>
<# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The steps need to be run individually
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #>
<# Step 1: Run this first to download your publi... |
PowerShellCorpus/GithubGist/gettuget_5246078_raw_a7291d9efff3edf4ebe3881200b1fb3da2e2586b_gistfile1.ps1 | gettuget_5246078_raw_a7291d9efff3edf4ebe3881200b1fb3da2e2586b_gistfile1.ps1 | ([regex]"(?s)log[^;{]*").matches((Get-ChildItem -recurse | where { ( $_.directoryName -match '.+[/\\]main[/\\]java.*') -and ($_.directoryName -notmatch '.+[/\\]internal.*') -and ($_ -match '.*\.java')} | Get-Content -encoding "UTF8" | out-string)) | foreach { if (($_.value.tolower().indexof("warn") -gt -1 -or $_.value... |
PowerShellCorpus/GithubGist/ricjac_11244068_raw_7c09205725cd12d854463a076afc69cbb37ba3e0_ADDisplayMultipleUserEmailAddr.ps1 | ricjac_11244068_raw_7c09205725cd12d854463a076afc69cbb37ba3e0_ADDisplayMultipleUserEmailAddr.ps1 | Import-Module activedirectory
$users2Find = @("USERNAME1","USERNAME2")
foreach ($user in $users2Find)
{
$tempuser = Get-ADUser $user -Properties mail
Write-Host $tempuser.mail
}
|
PowerShellCorpus/GithubGist/DominicCronin_9088961_raw_235c7faf6b02041b9aea7429676e312ae242b328_gistfile1.ps1 | DominicCronin_9088961_raw_235c7faf6b02041b9aea7429676e312ae242b328_gistfile1.ps1 | function get-ImportExportServiceClient {
param(
[parameter(Mandatory=$false)]
[AllowNull()]
[ValidateSet("Service","Upload","Download")]
[string]$type="Service"
)
InitImportExport
$binding = new-object System.ServiceModel.BasicHttpBinding
$binding.MaxBufferPoolSize = [int]::MaxValue
$binding.MaxReceived... |
PowerShellCorpus/GithubGist/altrive_7618509_raw_db8016a7818d05c1284a0edb075f3117646d89f9_XmlElementRemoting.ps1 | altrive_7618509_raw_db8016a7818d05c1284a0edb075f3117646d89f9_XmlElementRemoting.ps1 | $xmlDocument = [xml] "<root><elem>abcd</elem></root>"
$xmlElement = $xmlDocument.root
Invoke-Command localhost -ScriptBlock {
$arg = $using:xmlDocument
Write-Host ("Type={0}, Value={1}" -f $arg.GetType(), $arg.OuterXml)
}
Invoke-Command localhost -ScriptBlock {
$arg = $using:xmlElement
Write-Host ("Ty... |
PowerShellCorpus/GithubGist/jrwarwick_6216347_raw_a01f967ba270c26b57adbcccefd72d570fb1bdc3_gistfile1.ps1 | jrwarwick_6216347_raw_a01f967ba270c26b57adbcccefd72d570fb1bdc3_gistfile1.ps1 | $accumulatedList =''
foreach ($ws in dsquery computer -limit 1000 -name "*COMMON-NAME-FRAGMENT*" | dsget computer -samid | %{$_ -replace "\$",""}) {
$candidatehost = $ws.trim()
ping -n 2 $candidatehost
if ($LASTEXITCODE -eq 0) {
echo "##==-- TARGET UNIT ACTIVE! --------- $candidatehost --==##`a"
## t... |
PowerShellCorpus/GithubGist/rodolfofadino_3030382_raw_95d359702ddb2d8ad6e0b4245b6dbd7abe58a53d_gistfile1.ps1 | rodolfofadino_3030382_raw_95d359702ddb2d8ad6e0b4245b6dbd7abe58a53d_gistfile1.ps1 | Add-Type -Path "C:\Program Files (x86)\AWS SDK for .NET\bin\AWSSDK.dll"
$instancias = New-Object System.Collections.Generic.List[System.Collections.Hashtable]
$instancias.Add(@{"maquina" = "i-xxxxx"; "ip" = ""; endpoint= "https://ec2.sa-east-1.amazonaws.com/"})
##$instancias.Add(@{"maquina" = "i-xxxxx"; "ip" =... |
PowerShellCorpus/GithubGist/matiasherranz-santex_9785930_raw_8facee25158b8ffb9d435a62dbe1d66856553183_gistfile1.ps1 | matiasherranz-santex_9785930_raw_8facee25158b8ffb9d435a62dbe1d66856553183_gistfile1.ps1 | chmod a+x ~/.git-templates/hooks/post-commit
|
PowerShellCorpus/GithubGist/seankearon_04d4f152f81f0e5f2146_raw_7aa9ea5f045db452214e1e97e7268177a54c036e_get-script-folder.ps1 | seankearon_04d4f152f81f0e5f2146_raw_7aa9ea5f045db452214e1e97e7268177a54c036e_get-script-folder.ps1 | # Get the script's folder
function get_script_directory # http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$scriptpath = get_script_directory
cd $scriptpath
# Pause for user... |
PowerShellCorpus/GithubGist/stevenharman_1718397_raw_f58f1e957745dd4e6766fc63fe607c8163e8760a_jenkins-service-with-interactive.ps1 | stevenharman_1718397_raw_f58f1e957745dd4e6766fc63fe607c8163e8760a_jenkins-service-with-interactive.ps1 | # stolen from:
# http://lostechies.com/keithdahlby/2011/08/13/allowing-a-windows-service-to-interact-with-desktop-without-localsystem/
#
# NOTE: Be sure to run as Admin and restart to take effect.
$svcName = Get-Service -DisplayName *jenkins* | select -Exp Name
$svcKey = Get-Item HKLM:\SYSTEM\CurrentControlS... |
PowerShellCorpus/GithubGist/AmaiSaeta_7874062_raw_1a82df073c622100656b1381baf401d0400d86a4_gistfile1.ps1 | AmaiSaeta_7874062_raw_1a82df073c622100656b1381baf401d0400d86a4_gistfile1.ps1 | ((Get-Content Env:Path) -Split ";" | Where-Object { $_ -notmatch "\b" + "HOGEHOGE" + "\b" }) -Join ";" | Set-Content Env:Path |
PowerShellCorpus/GithubGist/Romoku_4001927_raw_de5c93662ed48237fa392059af011a541d4d9ae2_sample.ps1 | Romoku_4001927_raw_de5c93662ed48237fa392059af011a541d4d9ae2_sample.ps1 | $inDirectory = "c:\temp\downloads"
$encoderDirectory = "c:\temp\done"
$encoder = "c:\temp\done\sample.bat"
$logFile = "c:\temp\log.txt"
$extension = "*.jnt"
Function StripChar($s) {
$s.replace(" ","_").replace(",","_").replace("~","_").replace("#", "_")
}
Function MoveFile($filePath, $fileName) {
$newP... |
PowerShellCorpus/GithubGist/kurukurupapa_7297123_raw_73af4992c4cfda8a4bf1fc3025990801ff025bca_OdbcCommand002.ps1 | kurukurupapa_7297123_raw_73af4992c4cfda8a4bf1fc3025990801ff025bca_OdbcCommand002.ps1 | Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$WarningPreference = "Continue"
$VerbosePreference = "Continue"
$DebugPreference = "Continue"
# ライブラリ読み込み
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Data")
#####################################################################... |
PowerShellCorpus/GithubGist/mike2718_1213521_raw_8fde42d7ba294db8b129618f345db2ce5da14a56_GetMelonBooksTopillust.ps1 | mike2718_1213521_raw_8fde42d7ba294db8b129618f345db2ce5da14a56_GetMelonBooksTopillust.ps1 | # PSVersion : 2.0
# PSCulture : zh-CN
# PSUICulture : zh-CN
# get-topillust.ps1
# Program:
# Download topillustrations from MelonBooks.
# 从MelonBooks网站下载所有的Top图片
# 依赖 curl.exe
# History:
# 2012/02/04 Mike Akiba Second release
# 2014/09/29 Mike Akiba 修正起始图片的地址
curl.exe --progress-bar -R -O http:... |
PowerShellCorpus/GithubGist/davidalpert_8244886_raw_13cc63911391731e4787f0f4a7c3276ab42761c2_gistfile1.ps1 | davidalpert_8244886_raw_13cc63911391731e4787f0f4a7c3276ab42761c2_gistfile1.ps1 | PS C:\users\davida\dev\marv.git\src\Marv> cpack
Calling 'C:\Chocolatey\chocolateyInstall\nuget.exe pack -NoPackageAnalysis'.
Attempting to build package from 'Marv.csproj'.
Packing files from 'C:\users\davida\dev\marv.git\src\Marv\bin\Debug'.
Using 'Marv.nuspec' for metadata.
Found packages.config. Using packages... |
PowerShellCorpus/GithubGist/mikecrittenden_5896762_raw_ae9d370dc9feb61d370eccb477f8ee128babd651_gistfile1.ps1 | mikecrittenden_5896762_raw_ae9d370dc9feb61d370eccb477f8ee128babd651_gistfile1.ps1 | --timeout="<number of seconds" # Use "0" for all. Defaults to "900".
--count="<number of items>" # Defaults to "0" (all)
|
PowerShellCorpus/GithubGist/csharpforevermore_9179614_raw_7b3d394cbff75cf4e84e37da13aab60e81a79dbe_ListInstalledPrograms.ps1 | csharpforevermore_9179614_raw_7b3d394cbff75cf4e84e37da13aab60e81a79dbe_ListInstalledPrograms.ps1 | Get-WmiObject -Class Win32_Product | Select-Object -Property Name
|
PowerShellCorpus/GithubGist/philippdolder_add59168884bafca48a3_raw_ab594e5981950d8ae200eccfee9c0f797110ecf9_cmdlet.ps1 | philippdolder_add59168884bafca48a3_raw_ab594e5981950d8ae200eccfee9c0f797110ecf9_cmdlet.ps1 | function Tfs-UpdateFeature {
[CmdletBinding()]
param (
[parameter(Mandatory=$true)]
[ValidateScript({BranchExists $_})]
[string] $localBranch,
[parameter(Mandatory=$false)]
[string] $mainBranch = "master"
)
$shouldStash = git status --porc... |
PowerShellCorpus/GithubGist/gifnksm_261775_raw_d54f7a508f119c3c056447007691514ddbb305c5_fx_optimize_sqlite.ps1 | gifnksm_261775_raw_d54f7a508f119c3c056447007691514ddbb305c5_fx_optimize_sqlite.ps1 | param ([switch]$force)
$appProfDir = join-path $env:appdata "Mozilla\Firefox\Profiles"
$localProfDir = join-path $env:localappdata "Mozilla\Firefox\Profiles"
# http://csharper.blog57.fc2.com/blog-entry-206.html
function global:Invoke-Process
{
param ([string] $processPath, [string]$processArgs, [int]$time... |
PowerShellCorpus/GithubGist/guitarrapc_ad416c54c78469dc6474_raw_2ad571495f1f525746ac04f480d43a7e55fb5c3f_PowerShellStringEvaluation.ps1 | guitarrapc_ad416c54c78469dc6474_raw_2ad571495f1f525746ac04f480d43a7e55fb5c3f_PowerShellStringEvaluation.ps1 | # PowerShell の String中への変数埋め込みってば罠だらけね!
# 例 に示す変数をString中に表示するには5つ方法がある
$hoge = @{hoge = "hoge"}
$fuga = "fuga"
#1. 直 (Property指定がだめ
"$hoge"
'$hoge'
"$hoge.hoge"
#2. ${} でくくる。これもプロパティ指定がだめ (in-line評価 => bash スタイル)
"${hoge}"
"${fuga}"
#3. $() でくくる。部分式扱いなので、先行評価、展開される
"$($hoge.hoge)"
#4. "{0}" -f オ... |
PowerShellCorpus/GithubGist/wictorwilen_4f40541a78b54951ebb7_raw_f0b702fff0d7fe6c9c2dbafdec5f1b731510d036_Reset-SPCache.ps1 | wictorwilen_4f40541a78b54951ebb7_raw_f0b702fff0d7fe6c9c2dbafdec5f1b731510d036_Reset-SPCache.ps1 | asnp microsoft.sharepoint.powershell
Get-SPServer | ?{$_.Role -eq "Application"} | %{
Write-Host -ForegroundColor Green "Updating $_ ..."
Invoke-Command -ComputerName $_.Name {
Stop-Service SPTimerV4
Stop-Service SPAdminV4
Get-ChildItem $env:ALLUSERSPROFILE\Microsoft\SharePoi... |
PowerShellCorpus/GithubGist/racingcow_f550737490270d7ee760_raw_ddfbc33145245dcd65d07a170d7a72d62418ff16_servermachine.ps1 | racingcow_f550737490270d7ee760_raw_ddfbc33145245dcd65d07a170d7a72d62418ff16_servermachine.ps1 | ############################################################
# Join domain
############################################################
# Rename-Computer -NewName DEVCE1 -LocalCredential admin
# if (Test-PendingReboot) { Invoke-Reboot }
# Add-Computer -DomainName CT -Credential CT\imagioprodsvc
# if ... |
PowerShellCorpus/GithubGist/alanrenouf_1a0aefc4ddf3f37c6ea7_raw_7b13ceb999f12b1a93e58680b990c569605299a1_DeployVCNS_55.ps1 | alanrenouf_1a0aefc4ddf3f37c6ea7_raw_7b13ceb999f12b1a93e58680b990c569605299a1_DeployVCNS_55.ps1 | Connect-VIServer 192.168.1.200 -User administrator@vsphere.local -Password VMware1!
$vShieldInstallFile = "C:\Temp\VMware-vShield-Manager-5.5.3-2175697.ova"
$vShieldName = "VCNS01"
$vShieldNetwork = "VM Network"
$vShieldIP = "192.168.1.210"
$vShieldSNM = "255.255.255.0"
$vShieldDGW = "192.168.1.1"
$vShieldDNS = "192.1... |
PowerShellCorpus/GithubGist/belotn_7751223_raw_70bc470ce4f84940314a6df0401440cf9b8b3dca_set-xaserverlicence.ps1 | belotn_7751223_raw_70bc470ce4f84940314a6df0401440cf9b8b3dca_set-xaserverlicence.ps1 | get-xaserver | get-xaserverconfiguration |? {! $_.LicenseServerUseFarmSettings } |%{ set-xaserverconfiguration -ServerNAme $_.ServerName -LicenseServerUseFarmSettings $true }
|
PowerShellCorpus/GithubGist/mdnmdn_7352745_raw_c364cfa20b9a75fbd39862c43adc2d75927d7a0e_excel-lib.ps1 | mdnmdn_7352745_raw_c364cfa20b9a75fbd39862c43adc2d75927d7a0e_excel-lib.ps1 | if (! (Test-Path variable:global:excelApp)){
$global:excelApp = $null
}
function createExcel(){
if ($global:excelApp -eq $null){
doEng({
Write-Host 'new excel app'
$global:excelApp = New-Object -comobject Excel.Application
$global:excelApp.visible = $true
})
}
return $global:excelApp
}
... |
PowerShellCorpus/GithubGist/tamirko_b07f1810517628fc1980_raw_40bef5f8e7e9e3efdfab4f6892f89806a5011eae_gitClone.ps1 | tamirko_b07f1810517628fc1980_raw_40bef5f8e7e9e3efdfab4f6892f89806a5011eae_gitClone.ps1 | if ($ENV:GSA_MODE -ne "agent") {
# Create the git clone service/task here ….
$javaExe = "$javaDir\bin\java"
$gitUtilZipName = "gitUtil.zip"
$gitUtilZipUrl = "REPLACE_THIS_WITH_FULL_URL/$gitUtilZipName"
$gitUtilLocalZip = "$parentDirectory\$gitUtilZipName"
$gitUtilFolder = "$parentDirectory\gitutil"
$des... |
PowerShellCorpus/GithubGist/pohatu_5827442_raw_cf7060b90e81dac2987bce85536420e4a0bf286b_gistfile1.ps1 | pohatu_5827442_raw_cf7060b90e81dac2987bce85536420e4a0bf286b_gistfile1.ps1 | # Problem:
# In a country in which people only want boys every family continues to have children until they have a boy.
# If they have a girl, they have another child. If they have a boy, they stop.
# What is the proportion of boys to girls in the country?
$global:m=0; $global:f=0;
function havebabiesuntilbo... |
PowerShellCorpus/GithubGist/whataride_7638296_raw_7d91819dd987e839d45146cc36ebdf124e1eea4b_InteractWithDocNET.ps1 | whataride_7638296_raw_7d91819dd987e839d45146cc36ebdf124e1eea4b_InteractWithDocNET.ps1 | # Static method
[System.Diagnostics.Process]::GetProcessById(0)
# Static property
[System.DateTime]::Now
#Instance method
$process = Get-Prococess Notepad
$process.WaitForExit()
# Instance property
$today = Get-Date
$doday.DayOfWeek
|
PowerShellCorpus/GithubGist/bat2001_6465494_raw_266872b1720f636256ad62451d62a2c231856f8f_gistfile1.ps1 | bat2001_6465494_raw_266872b1720f636256ad62451d62a2c231856f8f_gistfile1.ps1 | $arrInstancesSuspended = @()
foreach ($Row in $DataSet1.Tables[0].Rows)
{
$arrInstancesSuspended = $arrInstancesSuspended + (,($Row["ApplicationName"],$Row["InstanceID"]))
# Use format: $arrInstancesSuspended [0][0]
}
# Sort Array
$arrInstancesSuspended = $arrInstancesSuspended | Sort-Object @{Expression={$_[0... |
PowerShellCorpus/GithubGist/wojtha_1034041_raw_1f09b634e99e7ddb67069abee6297630cc666e93_profile.ps1 | wojtha_1034041_raw_1f09b634e99e7ddb67069abee6297630cc666e93_profile.ps1 | # My preferred prompt for Powershell.
# Displays git branch and stats when inside a git repository.
# See http://gist.github.com/180853 for gitutils.ps1.
. (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1)
function prompt {
$path = ""
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions... |
PowerShellCorpus/GithubGist/cchitsiang_7038063_raw_e4e4eced2ef695a47985a3d44c98d26308179501_getuserandgroup.ps1 | cchitsiang_7038063_raw_e4e4eced2ef695a47985a3d44c98d26308179501_getuserandgroup.ps1 | -- Username1 | Group1, Group 2, Group 3, Group 4, Group 5 etc.
$memberOf = @{n='MemberOf';e={ ($_.MemberOf -replace '^CN=([^,]+).+$','$1') -join ';' }}
Get-QADUser -SizeLimit 0 | `
Select-Object Name,DN,SamAccountName,$memberOf | `
Export-Csv report.csv
|
PowerShellCorpus/GithubGist/coza73_461149c412b02cc64851_raw_368bb7ddb6c545c261c121f781fc09b23b8e7250_TemplateMigrate.ps1 | coza73_461149c412b02cc64851_raw_368bb7ddb6c545c261c121f781fc09b23b8e7250_TemplateMigrate.ps1 | <#
NAME: MigrateTemplages.ps1
AUTHOR: Cory Murdoch
EMAIL: cory at coryandwendy dot com
BLOG: http://vspherepowershellscripts.blogspot.com
.SYNOPSIS
Scipt to migrate selected templates from one virtualcenter to another
.DESCRIPTION
Exports templates from a selected folder location and im... |
PowerShellCorpus/GithubGist/adbertram_3d820b6062c2b30cdaca_raw_631e775153883c4b77e9085566ab5075070a45d7_gistfile1.ps1 | adbertram_3d820b6062c2b30cdaca_raw_631e775153883c4b77e9085566ab5075070a45d7_gistfile1.ps1 | #Requires -Version 4
<#
.NOTES
Created on: 10/8/2014
Created by: Adam Bertram
Filename: Start-ModPollMonitor.ps1
Requirements: Share permissions for Everyone on destination share
The source computer account Modify NTFS rights on destination folder
.DESCRIPTIO... |
PowerShellCorpus/GithubGist/kurukurupapa_6327478_raw_7f7990a0746e830922bd3557f7eb23f3b499c778_EnvOutputTest.ps1 | kurukurupapa_6327478_raw_7f7990a0746e830922bd3557f7eb23f3b499c778_EnvOutputTest.ps1 | $sep = "*" * 50
Write-Output $sep
Write-Output "カレントディレクトリ関連情報"
Write-Output $sep
Write-Output "`$pwd=$pwd"
#$tmp = Get-Location
#Write-Output "Get-Location=$tmp"
Write-Output "Get-Location=$(Get-Location)"
Write-Output $sep
Write-Output "コマンド実行情報"
Write-Output $sep
$MyInvocation
$basedir = Split-Pa... |
PowerShellCorpus/GithubGist/peaeater_c2bb6e80ff483b7e735c_raw_f253eba2d6bdf053459e5d3cb7a8e181c71b09f1_hocr.ps1 | peaeater_c2bb6e80ff483b7e735c_raw_f253eba2d6bdf053459e5d3cb7a8e181c71b09f1_hocr.ps1 | # ocr tif/png to hocr (html)
# requires tesseract
Param(
[string]$ext = "tif",
[string]$indir = ".",
[string]$outdir = $indir
)
if (!(test-path $outdir)) {
mkdir $outdir
}
$files = ls "$indir\*.*" -include *.$ext
foreach ($file in $files) {
$o = "$outdir\{0}" -f $file.BaseName
... |
PowerShellCorpus/GithubGist/grenade_8973223_raw_777b1e17a0e0a7b9ec0b2ba8ab7a29da83ad5f00_update-assembly-info.ps1 | grenade_8973223_raw_777b1e17a0e0a7b9ec0b2ba8ab7a29da83ad5f00_update-assembly-info.ps1 | param(
[string] $assemblyInfoFile,
[hashtable] $parameters
)
Write-Host ("`$assemblyInfoFile: {0}" -f $assemblyInfoFile)
foreach($key in $($parameters.Keys)){
if($parameters[$key] -ne $null){
$assemblyInfo = Get-Content $assemblyInfoFile
$pattern = ('^\[assembly: {0}\("(.*)"\)\]' -f $key)
$ol... |
PowerShellCorpus/GithubGist/pierre3_b17830375b620d1557a5_raw_8a20420dceedf9d7268f476bbb16847ea1eab1b0_MarkdownPreview.ps1 | pierre3_b17830375b620d1557a5_raw_8a20420dceedf9d7268f476bbb16847ea1eab1b0_MarkdownPreview.ps1 | # このスクリプト自身が格納されているディレクトリを取得
$Script:scriptDir = Split-Path $MyInvocation.MyCommand.Definition -Parent
<#
.Synopsis
Markdownテキストのプレビュー
.DESCRIPTION
Markdown形式で記述されたテキストファイルの内容をHTMLに変換し、ブラウザでプレビュー表示します。
.EXAMPLE
PS C:\> Start-Markdown .\markdownText.md
#>
function Start-Markdown
{
Param(
... |
PowerShellCorpus/GithubGist/ao-zkn_8a5f3ca446cac0f084db_raw_bc2734a88f131c2e1b83d9ec811b9da47b6b1e21_Rename-File.ps1 | ao-zkn_8a5f3ca446cac0f084db_raw_bc2734a88f131c2e1b83d9ec811b9da47b6b1e21_Rename-File.ps1 | # ------------------------------------------------------------------
# ファイル名をリネームする
# 関数名:Rename-File
# 引数 :FilePath 名前を変更するファイルパス
# :NewFileName 新しいファイル名前
# 戻り値:なし
# ------------------------------------------------------------------
function Rename-File([String]$FilePath, [String]$NewFileName){
if(Test-Path -... |
PowerShellCorpus/GithubGist/janikvonrotz_7819984_raw_38bf41c27ce7befbe8e9c1c9be4a013350abccf8_CreateFolderIfNotExist.ps1 | janikvonrotz_7819984_raw_38bf41c27ce7befbe8e9c1c9be4a013350abccf8_CreateFolderIfNotExist.ps1 | if(!(Test-Path -path $LogPath)){New-Item $LogPath -Type Directory}
|
PowerShellCorpus/GithubGist/santifdezmunoz_166397_raw_ff3fa6f1048cfdd8bb9da82a87c13fa57c15a304_listACL.ps1 | santifdezmunoz_166397_raw_ff3fa6f1048cfdd8bb9da82a87c13fa57c15a304_listACL.ps1 | #################################################################
# Script para obtener las listas de control de acceso asociadas #
# a un arbol de directorios. #
# #
# AUTOR: Santiago Fernández Muñoz ... |
PowerShellCorpus/GithubGist/nlinker_4249045_raw_a4f9b47db4b5b89fa02c117c9a65a9a1f8cddf1a_C_%5CVbox%5Crabbits-headless.ps1 | nlinker_4249045_raw_a4f9b47db4b5b89fa02c117c9a65a9a1f8cddf1a_C_%5CVbox%5Crabbits-headless.ps1 | # make sure this mode is enabled under administrator: Set-ExecutionPolicy RemoteSigned
# use a batch file like this:
# C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\Vbox\rabbits-headless.ps1
$items = @( 'vagrant-rabbitmq-cluster_1351840619', 'vagrant-rabbitmq-cluster_1351840685', 'vagrant-rabbitmq... |
PowerShellCorpus/GithubGist/abombss_4489558_raw_d20fc212e42c5763b8799ecf9221aa0a62e6c8ac_Install-AppFabricCache.ps1 | abombss_4489558_raw_d20fc212e42c5763b8799ecf9221aa0a62e6c8ac_Install-AppFabricCache.ps1 | function Uninstall-AppFabricCacheNode {
#TODO: Should try and remove the configuration stuff
gwmi win32_product -filter "Name LIKE 'AppFabric%'" |% {
$key="IdentifyingNumber=`"$($_.IdentifyingNumber)`",Name=`"$($_.Name)`",version=`"$($_.Version)`"";
([wmi]"Win32_Product.$key").uninstall()
... |
PowerShellCorpus/GithubGist/StephenLujan_5358305_raw_c15aa36b0fb61f730523c06dbcf01b6489c95822_fixSharePointNavigation.ps1 | StephenLujan_5358305_raw_c15aa36b0fb61f730523c06dbcf01b6489c95822_fixSharePointNavigation.ps1 |
function _fixLink([Microsoft.SharePoint.Navigation.SPNavigationNode]$link, [String]$bad, [String]$good) {
write-verbose ('checking link "' + $link.title + '" (' + $link.url + ')')
#$link | Get-Member
$url = $link.url -replace $bad, $good
if ([string]::Compare($url, $link.url, $True) -ne 0)
{
... |
PowerShellCorpus/GithubGist/gravejester_9599c63ee03a4c681f19_raw_3a7a6514f8d592c1a1a301c01af139aab5bceb7c_Measure-ScriptBlock.ps1 | gravejester_9599c63ee03a4c681f19_raw_3a7a6514f8d592c1a1a301c01af139aab5bceb7c_Measure-ScriptBlock.ps1 | function Measure-ScriptBlock {
<#
.SYNOPSIS
Measure time, memory consumption and CPU time for a block of code to execute.
.DESCRIPTION
Measure time, memory consumption and CPU time for a block of code to execute.
This function is using Measure-Command internal... |
PowerShellCorpus/GithubGist/sneal_62c28e6383b89e81f697_raw_1e29b69a13ff494485ceafd4370a0770cfe21f34_gistfile1.ps1 | sneal_62c28e6383b89e81f697_raw_1e29b69a13ff494485ceafd4370a0770cfe21f34_gistfile1.ps1 | $is_64bit = [IntPtr]::size -eq 8
$ssh_install_dir = "$env:ProgramFiles\OpenSSH"
$ssh_installer = "$env:TEMP\setupssh-6.4p1-1.exe"
$ssh_download_url = "http://www.mls-software.com/files/setupssh-6.4p1-1.exe"
if ($is_64bit) {
$ssh_installer = "$env:TEMP\setupssh-6.4p1-1(x64).exe"
$ssh_download_url = "http:/... |
PowerShellCorpus/GithubGist/n3wjack_8519114_raw_016ffc0d8b36259d31f5cc0cb2902c19b2c8c320__script-template.ps1 | n3wjack_8519114_raw_016ffc0d8b36259d31f5cc0cb2902c19b2c8c320__script-template.ps1 | <#
.SYNOPSIS
<script synopsys>
.DESCRIPTION
<full description>
.PARAMETER Foo
<foo description>
.PARAMETER Bar
<bar description>
.EXAMPLE
<example>
.EXAMPLE
<another example>
For more possible values see http://technet.microsoft.com/en-us/library/dd819489.aspx
#>
param (
[Switch]
$SwitchP... |
PowerShellCorpus/GithubGist/belotn_6867678_raw_a8680e2eb55d683bdb0ed4ba4b4f68c4e20df4ee_get-requiredGPOgFlag1L.ps1 | belotn_6867678_raw_a8680e2eb55d683bdb0ed4ba4b4f68c4e20df4ee_get-requiredGPOgFlag1L.ps1 | Get-ADOrganizationalUnit -Filter 'OU -like "*Citrix*"' -SearchBase 'dc=fabricam,dc=com' -Properties * |% { $_.gpLink -split ']' } |? { $_ -match '[0,2]$'} |% {(($_ -replace '\[','').split(';')[0]) -replace 'LDAP://',''} |% { get-adobject $_ -properties * } | sort -Unique DisplayName | select DisplayName,flags,@{N='fl... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 30