I’m working on some inventorying needs my company tasked me with and I’ve come across an interesting piece of the project. Currently, I’m able to go through an entire script using a list of server names and query them for their serial numbers. When I get to a point where a server I don’t have access to pops up, I get an access denial. Here is the script I’m using:
$computers = Get-Content c:pstestcomputerlist.txt Get-wmiobject Win32_Bios -ComputerName $computers | Select-Object __SERVER, SerialNumber
How can I modify this to continue running even if the server returns an access denial?
submitted by /u/Moviefreak4702
[link] [comments]
The post Modify script to continue after access denial appeared first on How to Code .NET.