====== PowerShell ======
===== Basic =====
==== Temporary add a directory to the PATH variable ====
$ENV:PATH += ";C:\Users\Admin\bin"
==== Parse integer ====
PS H:\> $x = Read-Host
a
PS H:\> [int32]::TryParse($x,[ref]0)
False
PS H:\> $x = Read-Host
5
PS H:\> [int32]::TryParse($x,[ref]0)
True
==== Multidimensionale Arrays ====
PS C:\> $a = ( "a", "b", "c" ),( "d", "e", "f" )
PS C:\> $a += ,( "g", "h", "i" )
PS C:\>
PS C:\> $a[0]
a
b
c
PS C:\> $a[2]
g
h
i
PS C:\> $a[0][0]
a
PS C:\> $a[2][0]
g
PS C:\>
===== Scheduled Tasks =====
==== Change Priority ====
This will only change the priority setting and keep the other settings. The password of the task user is required.
$task = Get-ScheduledTask -TaskName "ThisIsMyTask"
$settings = $task.Settings
$settings.Priority = 5
Set-ScheduledTask -TaskName $task.TaskName -Settings $settings -User $task.Principal.UserId -Password "asdf1234"