Viewing the security set on an Active Directory object is useful for troubleshooting and for security event investigations. Get-ADObjPermissions_ps1 reads your AD schema data, and provides a list of security set with both the setting and the delegate. This does not require admin permissions or any modules to run. It take’s the object’s distinguished name…
Find AD Object’s DistinguishedName
Getting the distinguishedname of an Active Directory object is a common administrative task. Find-ADObject_ps1 makes it easy to get this information for users, computers and groups using System.DirectoryServices.DirectorySearcher instead of the ActiveDirectory module. Admin rights are not required. The syntax is simple, ex: .\Find-ADObject.ps1 -adobject ‘MyGroup’ -ADObjectType Group.
Logoff User, Shutdown or Reboot Computer
Send-LogoffShutdown_ps1 is an interactive script with the following menu options: Logoff, Force Logoff (NO SAVE), Powerdown, Force Powerdown (NO SAVE), Reboot, Force Reboot (NO SAVE), Ping test, Check for logged on user(s), and Send User(s) Message. Most of the work is done using WMI.
Is Anybody Using this Workstation?
In a large enterprise you may want to re-deploy unused computers which have been set up but are lightly used or never used. Get-PClastUserLogon_ps1 uses a WMI query to get the last writetime of the user profiles to get this information.
Get Reboot History of Computer from Event Log
Getting the last reboot for a computer is easy and a common task in the administration of servers and workstations. It is a bit more complicated to get the reboot history. I use Get-WinEvent with the filterxml option. Below is the full text of the script, as WordPress has trouble with the text file. The…
Remotely Execute GPRESULT, and Collect Results
A common program for troubleshooting group policies is gpresult. Get-GPResult_ps1. This interactive script uses WMI to allow the administrator to target an existing user on the remote computer, and then to run either gpresult /h or gpresult /v. The results are written to a temporary file on the remote machine, then displayed when the data…
Run Group Policy Update on Remote Computer
Run-GPUpdate_ps1 is a simple script to remotely execute gpupdate /force on a remote computer with this command: invoke-command -ScriptBlock { & cmd /c “C:\windows\system32\gpupdate.exe” /force } -Session $s
Get System Information from a Remote PC
Get-SystemInfo_ps1 is a simple interactive script for remotely running the SystemInfo command remotely: invoke-command -ErrorAction stop -computername $ComputerName -ScriptBlock { systeminfo /fo list } The results are displayed in a text box form.
It’s About Time
I recently went down the rabbit hole working with PowerShell, datetime and time zone calculations. Here are some of the things that I learned: Use [datetimeoffset] instead of [datetime]. [datetimeoffset] has the daylight savings offset as part of the object. Example: [datetimeoffset]$ThisDate = Get-Date -Year 2007 -Month 3 -Day 10 -Hour 0 -Minute 0 -Second…
Test Disk Status
My home media server lost a hard drive earlier this year. I had no idea how long it had been in service, or that it was about to go, despite this data being available from WMI. Test-DiskStatus.ps1 will give you the following information for each drive on the system queried: drive letter, size in GB,…