10 Inventory expert
This chapter covers:
- Querying Active Directory for enabled computers
- Quickly checking whether computers are online
- Checking a variable for multiple different values without nested if/else statements
- Gathering information from remote computers
- Outputting arrays to CSVs
If you’ve been in the IT industry long, you realize there is a lot of data to manage. Each computer has dozens of components and characteristics that are valuable. If a new virus, for example, affects only specific versions of Windows 10 it can be a mad dash to figure out exactly how many computers in your company are at risk and need to be mitigated and accounted for.
Hard Drive space can fill up rapidly, and critical data may be irrevocably lost once a drive is full. As PCs age, you may need to upgrade RAM to keep the system functional. Serial numbers are often used by vendors for support, and for remote computers, in the past, gathering all of the required data meant a phone call at best and perhaps even a trip to the location at worst to get this information and more. Worse, if you didn’t gather all of the data or recorded it incorrectly this could mean a costly re-work.
Wouldn’t it be nice if we could simply run a script and gather all of this information and more from any computer, a list of computers (say all of the PCs in a particular geographic location), or all of the active computers on your domain? This is exactly the need we’re going to address in this very chapter!