TobyDeDrone Posted July 3, 2017 Member ID: 25297 Group: ***- Inactive Clan Members Followers: 0 Topic Count: 26 Topics Per Day: 0.01 Content Count: 82 Content Per Day: 0.03 Reputation: 83 Achievement Points: 835 Solved Content: 0 Days Won: 0 Joined: 11/26/16 Status: Offline Last Seen: May 6, 2022 Share Posted July 3, 2017 (edited) I've been working on some simple little snippets using Powershell that can come in handy if anyone's interested. Ill keep updating this post with new ones i create and if you need anything powershell related just let me know First one can be ran in powershell but its a dquery rather than an actual script. Quote dsquery * -Limit 0 -filter "(&(objectCategory=person)(objectClass=user)(department=*))" -Attr Samaccountname Displayname department > DerpDerp.txt This one calls back to AD and outputs Username, Display name and their Department to a file called DerpDerp.txt (this can be whatever you want) Quote $pcname=read-host "Enter the computer name:" gwmi win32_computersystem -comp $pcname | select USername,Caption,Manufacturer This allows you to see what user is logged onto a specific PC / Server it will also use WMI to pull back the manufacturer of the hardware. Quote $User = Read-Host "Enter Username" Import-Module ActiveDirectory Get-ADUser $User -properties PasswordLastSet | Format-List Now the last one is just because i was messing around with Powershell this allows you to see when a specific users password was last set, But as i'm sure you know type "net user TargetUsername /domain" into the cmd applet will also yield the same results. All these lines just need to be saved as .ps1 to allow them to execute. Edited July 3, 2017 by TobyDeDrone Link to comment Share on other sites More sharing options... Awards
Recommended Posts