Monday, December 12, 2016
Power Shell - Get UNC Path Directories
http://stackoverflow.com/questions/23574653/running-get-childitem-on-unc-path-works-in-powershell-but-not-in-powershell-run
cd env:
$foo = @{Name = "Foo"}
$foo.Path = "\\serverPath\someDir\"
$bar = @{Name = "Bar"}
$bar.Path = "\\serverPath\someDir\"
cd c: #THIS IS THE CRITICAL LINE
@( $foo, $bar ) | ForEach-Object {
$item = Get-ChildItem $_.Path
# Do things with item
Write-Host $item
}
Subscribe to:
Posts (Atom)