Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Using credential param as optional..

$
0
0

So I have a function that I am building to get inventory information from various computers on our network. One of the parameters for this is Credential.

I am doing four WMI queries (so far) to grab os, bios, system, disk information. I am thinking there has to be a better, cleaner way to do it than go:

if($credential)
{
# run all wmi queries with credential
}
else
}
# run all wmi queries without credentials
}

What is this better way?

Thanks
sb


Viewing all articles
Browse latest Browse all 13067

Trending Articles