Command 3) Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'" | Select name -expandproperty name
Command 4) Get-ChildItem -Path C:\Users\ | select-object Name
Q1. Is anyone able to add my commands to an example for me to play with?
Q2. I have to run this against computers (200+) within a domain. There are only a few systems with WSMan enabled, I will need to look at that on a separate note. If WS Man was enabled across all systems, would invoke-command would be the best option?
As my script stands, I can Enter-PSSession and manually RUN the script against a remote PC, but I want to do this against ALL my computers.
Really often you are not the first with a given task. Did you try to search for a solution? If I search in Google for "powershell wmi local administrators group" I get as the first hit "Get remote machine members of Local Administrator group"
So no need to reinvent the wheel. 😉
... and also really often looking at other peoples code is indeed a great way to learn somthing about Powershell.