This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
"foo.txt", "bar.txt" | %{ | |
$ScriptBlock = { | |
param($name) | |
Write-Host "[processing '$name' inside the job]" | |
Get-Content "$name" | %{ | |
Write-Host "Content: $_" | |
} | |
Start-Sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Install Chocolatey | |
#iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
##Install BoxStarter | |
#choco install boxstarter | |
# | |
#Or simpler: | |
#http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/JohnLBevan/d79a6973509bf5bae425/raw/97b183bbba7946b8992e037e56f7bdb347a930be/BoxStarter_AppServicesTeam.txt | |
#ref: see https://github.com/mwrock/Chocolatey-Packages/blob/master/mwrock-TfsDesktop/tools/ChocolateyInstall.ps1 for a great example script | |
#https://gist.github.com/DavidBoike/11269706/4007b58e122dcb926cc7f0e4f134e51bfaebee78 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([Switch]$Fix, [Switch]$Verbose) | |
<# | |
During our testing of in-place upgrades of BizTalk 2010 to BizTalk 2013 we've seen performance counters disappear (especially the BizTalk:Message Agent and BizTalk:Messaging counters). | |
Inspired by: | |
• http://blogs.msdn.com/b/biztalkperformance/archive/2007/09/30/how-to-manually-recreate-missing-biztalk-performance-counters.aspx | |
• http://blogs.msdn.com/b/biztalkcpr/archive/2010/06/23/have-you-manually-recreated-the-biztalk-performance-counter-using-the-following-link-but-some-of-the-counters-were-still-missing.aspx | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$source = '\\path\to\source' | |
$destination = '\\path\to\dest' | |
robocopy "$source" "$destination" /zb /e /xf * | |
<# | |
See https://ss64.com/nt/robocopy.html for notes | |
/zb - If you get access denied on a folder, try using backup mode to access it (see http://www.rainingforks.com/blog/2015/suggested-robocopy-switches-explained.html for detail) | |
/e - Copy subfolders (/s), including empty ones. | |
/xf * - exclude files matching a filename pattern; in this case any filename, so only copy directories | |
Note: dest will contain the child folders of source; not source itself. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserSettings> | |
<override-colours caret="e6e6fa" indentGuides="282828" /> | |
<override-classes> | |
<style-class name="default" font="Monaco" back="272828" fore="fafafa" /> | |
<style-class back="222222" fore="666666" name="linenumbers"></style-class> | |
<style-class name="comment" fore="d500d5"/> | |
<style-class name="keyword" fore="f47a00" bold="true"/> | |
<style-class name="string" fore="5fff61" /> | |
<style-class name="number" fore="fafafa" /> | |
<style-class name="identifier" fore="fddf39" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import web | |
urls = ( | |
'/(.*)', 'Service' | |
) | |
app = web.application(urls, globals()) | |
class Service: | |
def GET(self, name): | |
web.header('Access-Control-Allow-Origin', '*') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-FileEncoding($Path) { | |
$bytes = [byte[]](Get-Content $Path -Encoding byte -ReadCount 4 -TotalCount 4) | |
if(!$bytes) { return 'utf8' } | |
switch -regex ('{0:x2}{1:x2}{2:x2}{3:x2}' -f $bytes[0],$bytes[1],$bytes[2],$bytes[3]) { | |
'^efbbbf' { return 'utf8' } | |
'^2b2f76' { return 'utf7' } | |
'^fffe' { return 'unicode' } | |
'^feff' { return 'bigendianunicode' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[enum]::getvalues([type]'ConsoleColor') | ForEach-Object{ | |
$curForeground = $_ | |
[enum]::getvalues([type]'ConsoleColor') | ForEach-Object{ | |
$curBackground = $_ | |
$msgStart= "Foreground={0}, Background={1}" -f $curForeground,$curBackground | |
$msgStart += (New-Object string -ArgumentList @(' ',(50-$msgStart.Length))) | |
$msgStart | Write-Host -NoNewline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#based on code from this blog: https://mcpmag.com/articles/2015/06/18/reporting-on-local-groups.aspx | |
function Get-AdsiComputer { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] | |
[string]$ComputerName = $env:COMPUTERNAME | |
) | |
process { | |
[ADSI]("WinNT://$ComputerName,computer") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($global:RestartRequired=0, | |
$global:MoreUpdates=0, | |
$global:MaxCycles=10) | |
function Check-ContinueRestartOrEnd() { | |
$RegistryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" | |
$RegistryEntry = "InstallWindowsUpdates" | |
switch ($global:RestartRequired) { | |
0 { | |
$prop = (Get-ItemProperty $RegistryKey).$RegistryEntry |
OlderNewer