I need a script to run against all of the machines in my domain to get Local account details. I want to use Get-WMIobject if possible because it works on remote machines without opening up extra security. I have used Get-WmiObject win32_User account to get many properties but it does not include password last changed time or groups the user account is a member off. I can use net user command to get the information I need but only on a local computer and I can not get it to export to a csv. when I do this the only output I get is numbers. I am very new to scripting and powershell and any help would be greatly appreciated. I need this information to verify compliance requirements.
Asked
Active
Viewed 1,535 times
0
-
Please add some code to explain more, the community doesn – OneStig Jan 20 '16 at 23:20
-
't like to read just blocks of text. Srry about that, I accidentally pushed enter. – OneStig Jan 20 '16 at 23:21
-
And my editing isn't working. – OneStig Jan 20 '16 at 23:21
-
To put it somewhat differently, SO is here to solve (programming) problems not provide help. You can review the help resources for more info on what constitutes a good question. – Χpẘ Jan 21 '16 at 00:27
-
Ok, I have seen many posts on here with people asking how to develop a powers hell script to do specific things. The only difference is they post the script that did not work and then someone posts a different script to solve the issue, can you recommend a site for someone who is new to scripting that doe provide HELP. It is difficult to find information on even the properties that are available with different commands. – J Maloney Jan 22 '16 at 01:35
1 Answers
0
$computer='RemoteComputer'
$account='Administrator'
$objUser=[ADSI]"WinNT://$computer/$account"|select @{l="PasswordAge";e={[string]$_.PasswordAge}}
$dtmChangeDate = (get-date).addseconds(-$objUser.PasswordAge)
'{0}\{1} password last changed {2:yyyy/MM/dd HH:mm:ss}' -f $computer,$account,$dtmChangeDate|write-host

Mikel V.
- 351
- 2
- 8