WINDOWS OS HALDUS
$isa=$env:UserName
write-host $isa
$ema=read-host
Rename-LocalUser-Name $isa -NewName $ema
Write-Host "Hello world!"
$usr= "Tobi"
$pass= "123"
Net user $usr $pass /ADD
Get-Date
Get-Service
Remove-LocalUser -Name $usr
Write-Host "Goodbye, cruel world!
Arvutusscript:
$a=Read-Host
$c=[int]$a
$b=Read-Host
$d=[int]$b
Write-Host ($c+$d)
17.11.17
Lustmgr.msc
Secpol.msc
Gpedit.msc
-gt> - greater than
-lt< - less than
-eq= equals
-le<= - less or equal
-ge=> - greater or equal
Korrutustabel 10nega:
For ($i=0; $i -le 10; $i++) {
"10 * $i = " + (10 * $i)
}
Värvide list:
$colors = @("Red","Orange","Yellow","Green","Blue","Indigo","Violet")
For ($i=0; $i -lt $colors.Length; $i++) {
$colors[$i]
}
Loendab arve kuni 10neni:
$i=1
Do {
$i
$i++
}
While ($i -le 10)
$i=1
Do {
$i
$i++
}
Until ($i -gt 10)
Loogiliste ketaste vahemahu kuvamine:
Get-WMIObject Win32_LogicalDisk | ForEach-Object {$_.FreeSpace}
Get-WMIObject Win32_LogicalDisk | ForEach {$_.FreeSpace}