Q. Can I use PowerShell to create and compare a configuration baseline?
A. Almost anything you can "Get" is eligible for this trick. Start by getting your baseline into an XML file. Let's say you're working with services. You'd use the command:
Then, when you're ready to compare the current state to the baseline, you'd run:
That all gets written on one line. Compare-Object also has an alias, Diff.
The comparison will compare every attribute of those objects. That works well for many management objects such as services but not all. Processes, for example, are constantly changing. You expect a process's CPU usage, for example, to change, so you wouldn't compare everything. Instead, you'd just pick one or two properties to compare, as in:
Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.