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