From aeb411790f7a39bdcffe57ab2ba22c3b526b2780 Mon Sep 17 00:00:00 2001 From: OriolFilter Date: Mon, 4 Apr 2022 03:12:48 +0200 Subject: [PATCH] Update --- Notes.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Notes.md b/Notes.md index 9fd31b6..46c0701 100644 --- a/Notes.md +++ b/Notes.md @@ -13,6 +13,14 @@ $x="Text" $arry = @("a", "b", "c") ``` +### Hash Array + +[MS documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_hash_tables?view=powershell-7.2) + +``` +$X=@{ = ; [ = ] ...} +``` + ## User Interaction ### Output @@ -64,6 +72,14 @@ Write-Host $text | Out-File $path ## Operators +### Check if last command executed correctly + +```ps +# Do something +echo $? +``` + + ### Looping #### For @@ -76,8 +92,13 @@ Write-Host $text | Out-File $path Enter-PSSession –ComputerName $hostname [-Credential username] ``` > If username gets left behind, the current user will be used +### Send command remotely +```ps +Invoke-Command -ComputerName hostname1, hostname2 -ScroptBlock {$COMMAND} +``` + # Hypver-V specific @@ -85,7 +106,10 @@ Enter-PSSession –ComputerName $hostname [-Credential username] [//]: # (https://adamtheautomator.com/hyper-v-powershell/) ### Create new host + +```ps New-VM -Name "HYPER" -MemoryStartupBytes 512MB +``` ### List current VM Get-VM \ No newline at end of file