Quantcast
Viewing all articles
Browse latest Browse all 21975

How to add local groups to local user account PS script

Hello, I am a PowerShell 3.0 novice and want to add a feature to my first ever production script tool.

The script below will get all local user accounts from remote computers listed in a .txt file then export to .csv format.  How exactly can I incorporate what local groups each local user account is a member of?  For each local user account retrieved I want to list what local groups it is a member of.

get-ciminstance -classname win32_useraccount -filter “localaccount=’true’” -computername (get-content C:\PS\<listofcomputers>.txt) | export-csv c:\PS\<name>_localuseraccounts.csv (export to .csv)

Your insight is greatly appreciated,

Matt, PS 3.0 novice


Matt


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>