ForEach, ForEach-Object. , ForEach.
ForEach:
Foreach ($localpath in $dispaths)
, $localpath not $_
write-host "Deleting Profile: $_.localpath ($count of $total)"
:
write-host "Deleting Profile: $($Localpath.localpath) ($count of $total)"
, , ForEach ForEach-Object. , :
Get-WMIObject -Class Win32_UserProfile -ComputerName $cname |
Where-Object {$_.localpath -eq $localpath.localpath} |
ForEach-Object {$_.Delete()}
, ForEach-Object, $_ . $localpath ForEach.