Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Get-Content c:computers.txt | `
  2. Select-Object @{Name='ComputerName';Expression={$_}},@{Name='FolderExist';Expression={ Test-Path "\$_c$program files (x86)thefolder"}}
  3.  
  4. Get-Content .computers.txt |
  5. Select-Object @{Name='ComputerName';Expression={$_}},
  6. @{Name='Online';Expression={(Test-Connection $_ -count 1 -EA 0).StatusCode -eq 0}},
  7. @{Name='FolderExist';Expression={ Test-Path "\$_c`$program files (x86)common files"}}
  8.  
  9. ComputerName Online FolderExist
  10. ------------ ------ -----------
  11. Computer01 True True
  12. Computer02 False False
  13. Computer03 True False
  14.  
  15. Get-Content .computers.txt |
  16. Select-Object @{n='ComputerName';e={$_}},
  17. @{n='FolderExist';e={ If(Test-Connection $_ -Quiet -Count1){Test-Path "\$_c`$program files (x86)common files"}else{"Offline"}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement