-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00_Demo1.ps1
43 lines (34 loc) · 1.15 KB
/
00_Demo1.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$procesi = Get-Process
Write-Output $procesi
Write-Output "Vaše uporabniško ime je $env:USERNAME."
Get-Process | Out-GridView
Get-Process | Where-Object { $_.Id -gt 10000 }
$pogoj = $true
if ( $pogoj )
{
Write-Output "Vrednost spremenljivke `$Pogoj je $Pogoj."
}
else
{
Write-Output "Vrednost spremenljivke `$Pogoj je $Pogoj."
}
$procesi[0] | ForEach-Object {
#$_.Id
$_
}
Remove-Variable procesi
Get-ChildItem # Modify [CmdletBinding()] to [CmdletBinding(SupportsShouldProcess=$true)]
$paths = @()
foreach ($aPath in $Path) {
if (!(Test-Path -LiteralPath $aPath)) {
$ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find path '$aPath' because it does not exist."
$category = [System.Management.Automation.ErrorCategory]::ObjectNotFound
$errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$aPath
$psCmdlet.WriteError($errRecord)
continue
}
# Resolve any relative paths
$paths += $psCmdlet.SessionState.Path.GetUnresolvedProviderPathFromPSPath($aPath)
}
Start-Transcript
Stop-Transcript