Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Assist with Error Handling

$
0
0

Hello all – I’m somewhat fresh to powershell scripting, at least for things more than one or two lines.

I have a script I’ve been working on that uses a number of instances of get-wmiobject to connect to a remote computer and gather a) info on it’s NIC config, b) local user accounts and c) members of local admin group.

I give it a list of computers in the form of an input file, and then use a foreach to loop through those items.

How can I make it skip to the next host if the first get-wmiobject item fails?

For reference, I’ve uploaded my full script to Pastebin here:

http://pastebin.com/2TAY9EQT

submitted by /u/insufficient_funds
[link] [comments]

The post Assist with Error Handling appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Latest Images

Trending Articles



Latest Images