first commit

This commit is contained in:
OriolFilter 2022-04-03 09:57:06 +02:00
parent 6b6b72a989
commit 0aa358cac1
3 changed files with 94 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.idea/
/HyperV_PS.iml

91
Notes.md Normal file
View File

@ -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] <Object>]
[-NoNewline]
[-Separator <Object>]
[-ForegroundColor <ConsoleColor>]
[-BackgroundColor <ConsoleColor>]
[<CommonParameters>]
```
```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

1
Testing/simple_for.ps1 Normal file
View File

@ -0,0 +1 @@
## For example