This file contains hidden or 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
#Using WMI for Legacy print servers (prior to 2012R2) | |
gwmi Win32_Printers | select name,portname,network,sharename,status,systemname,published,location,printerstatus,drivername,description,comment,deviceid | export-csv |
This file contains hidden or 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 find-common-values($oArr) { | |
$i = 0 | |
$commonValues = $oArr[0] | |
$oArr | % { | |
$i++ | |
if($commonValues -eq $null) { return "Well shucks, after $i iterations" } | |
$commonValues = Compare-Object $commonValues $_ -IncludeEqual -PassThru -ExcludeDifferent | |
} | |
This file contains hidden or 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 vd($v, $p) { | |
if($v -eq $null) { | |
echo "[$p] -> null" | |
} else { | |
$v | gm -MemberType Property | % { | |
if ($_.Definition.ToString() -match "\[\]") { | |
for($i = 0; $i -lt $v.$($_.name).length; $i++) { | |
vd $v.$($_.name)[$i] "$p.$($_.name)[$i]" | |
} | |
} elseif ($_.Definition -cmatch "(^System)|(^[a-z])") { |
This file contains hidden or 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
get-vmhost | foreach { | |
echo "PROCESSING $($_.Name)" | |
(get-esxcli -vmhost $_.name).system.settings.advanced.list($true) | |
(get-esxcli -vmhost $_.name).system.settings.kernel.list($true) | |
} |
This file contains hidden or 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
#Run from SQL Server Powershell session SQLSERVER:\SQL\<servername>\DEFAULT\jobserver\jobs\ | |
$badJobs = @() | |
gci | foreach { | |
if($_.jobsteps[0] -match "Primary") { | |
echo "JOB: $($_.Name)" | |
echo "Has jobstep $($_.JobSteps[0].Name)" | |
} else { |
This file contains hidden or 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
#Powershell script to generate SFZ file, MIDI file, and regions for REAPER DAW | |
$alphabet = "c,c#,d,d#,e,f,f#,g,g#,a,a#,b," -split "," | |
$midiNotes = @() | |
$n = 0 | |
$oct = 0 | |
for($i = 0; $i -lt 127; $i++) { | |
$midiNotes += ($alphabet[$n] + $oct) | |
$n = $n + 1 | |
if($n -eq 12) { $n = 0; $oct = $oct + 1 } | |
} |
This file contains hidden or 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
SELECT create_time, vm_name, username, host_name, event_type | |
FROM VPX_EVENT | |
WHERE event_type IN ('vim.event.VmBeingDeployedEvent', | |
'vim.event.VmCreatedEvent', | |
'vim.event.VmRegisteredEvent', | |
'vim.event.VmClonedEvent') | |
ORDER BY create_time DESC |
This file contains hidden or 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
get-datacenter | foreach { | |
$dc = $_.Name | |
$_ | get-cluster | foreach { | |
$cluster = $_.Name | |
$count = (get-view -viewtype "VirtualMachine" -Property Name -Filter @{"Runtime.PowerState"="PoweredOn"} -SearchRoot (get-view $_).moref | Measure-Object).Count | |
write-output "$dc, $cluster, $count" | |
} | |
} |
NewerOlder