Try method in powershell

Posted by Willy on Stack Overflow See other posts from Stack Overflow or by Willy
Published on 2010-05-12T16:50:11Z Indexed on 2010/05/12 16:54 UTC
Read the original article Hit count: 175

Filed under:
|

So I want to build a try method into my powershell script below. If I am denied access to a server, I want it to skip that server. Please help..

[code]$Computers = "server1", "server2"

Get-WmiObject Win32_LogicalMemoryConfiguration -Computer $Computers | Select-Object `
@{n='Server';e={ $_.__SERVER }}, `
@{n='Physical Memory';e={ "$('{0:N2}' -f ($_.TotalPhysicalMemory / 1024))mb" }}, `
@{n='Virtual Memory';e={ "$('{0:N2}' -f ($_.TotalPageFileSpace / 1024))mb" }} | `
Export-CSV "output.csv"[/code]

© Stack Overflow or respective owner

Related posts about powershell

Related posts about wmi