Ken Maglio
Automation Solution Engineer My License Plate says it all "I-AU2M8"
Beyond the Basics
The top ten commands every admin should know
Get-
Takes output from one command and sends it to the next
This is a form of ITERATION
Start-
Stop-
Restart-
Stop-
Select-
Really it does help!
[type]$variable
Context-aware dot (.) intelligence
.Net Data Types
[string] Fixed-length string of Unicode characters [char] A Unicode 16-bit character [byte] An 8-bit unsigned character [int] 32-bit signed integer [long] 64-bit signed integer [bool] Boolean True/False value [decimal] A 128-bit decimal value [single] Single-precision 32-bit floating point number [double] Double-precision 64-bit floating point number [DateTime] Date and Time [xml] Xml object [array] An array of values [hashtable] Hashtable object
Automatic conversion does not change the variable’s data type.
The fun parts of PowerShell!
Well in my insanity it is....
$a = "is" $b = "amazing" $str = "This {0} an {1} feature!" -f $a, $b
$str = "This" + $a + "an" + $b + "feature!"
--or--
$str = "This $($a) an $($b) feature!"
But now how you think.... switch ($true){ (1 -eq 1) { write-host "int" } ("car" -eq "car") { write-host "string" } default { write-host "hahaha" }
}
Alternate: Only one Truthy
(1 -eq 1) {
write-host "int"
break
}
Stop using CSV for a data-store
ConvertTo-Json
ConvertFrom-Json
This could be an entire session
But seriously - they are amazing!
By Ken Maglio
Beyond the basics
Automation Solution Engineer My License Plate says it all "I-AU2M8"