diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c1a1005 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.idea/ +/HyperV_PS.iml diff --git a/Notes.md b/Notes.md new file mode 100644 index 0000000..9fd31b6 --- /dev/null +++ b/Notes.md @@ -0,0 +1,91 @@ +# Powershell + + +## Data storing + +### Variable +```ps +$x="Text" +``` +### Array + +```ps +$arry = @("a", "b", "c") +``` + +## User Interaction + +### Output + +#### Write-Host + +Also accepts from redirection + +``` +Write-Host + [[-Object] ] + [-NoNewline] + [-Separator ] + [-ForegroundColor ] + [-BackgroundColor ] + [] +``` + + +```ps +Write-Host "text" +``` + +#### Write-Output + +```ps +Write-Output "text" +``` + +## Filtering + +```ps +Write-Output "text" | Select-String -pattern $filters -notMatch +``` +## File interactions + +### Read file + +```ps +Get-Contents $path +``` + +### write to file + +```ps +Write-Host $text | Out-File $path +``` + + +## Operators + +### Looping + +#### For + +#### For each + +## Management +### Access remote PS server +```ps +Enter-PSSession –ComputerName $hostname [-Credential username] +``` +> If username gets left behind, the current user will be used + + + +# Hypver-V specific + +## Management +[//]: # (https://adamtheautomator.com/hyper-v-powershell/) + +### Create new host +New-VM -Name "HYPER" -MemoryStartupBytes 512MB + +### List current VM +Get-VM \ No newline at end of file diff --git a/Testing/simple_for.ps1 b/Testing/simple_for.ps1 new file mode 100644 index 0000000..8b54423 --- /dev/null +++ b/Testing/simple_for.ps1 @@ -0,0 +1 @@ +## For example \ No newline at end of file