NEED TO GET ALL USER ACCOUNTS ON MY NETWORK/DOMAIN WITH A SCRIPT

Copper Contributor

Good day Colleagues,

 

Hope y'all doing well!

 

Coming for a help here because recently i need to get from my mainserver all user accounts active and inactive (True/False) that i have on my network using PowerShell. The point is to gather all them and create a file where i have them all organized.

 

i've been trying to do it using the following scritp but haven't been sucessful: 

Get-LocalUser | Out-File c:\$env:username.txt

 

Please let me know if y'all have a solution for it.

 

Thanks in advance

 

 

1 Reply