Alan's Blog

"Yeah. I wrote a script that will do that."

Menu
  • About My Blog
Menu

Get Security Set on Active Directory Objects

Posted on December 25, 2021 by Alan

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…

Read more

Find AD Object’s DistinguishedName

Posted on December 25, 2021December 25, 2021 by Alan

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.

Read more

Logoff User, Shutdown or Reboot Computer

Posted on December 25, 2021 by Alan

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.

Read more

Is Anybody Using this Workstation?

Posted on December 25, 2021 by Alan

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.

Read more

Get Reboot History of Computer from Event Log

Posted on December 25, 2021 by Alan

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…

Read more

Remotely Execute GPRESULT, and Collect Results

Posted on December 25, 2021December 25, 2021 by Alan

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…

Read more

Run Group Policy Update on Remote Computer

Posted on December 25, 2021 by Alan

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

Read more

Get System Information from a Remote PC

Posted on December 25, 2021 by Alan

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.

Read more

It’s About Time

Posted on October 24, 2020 by Alan

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…

Read more

Test Disk Status

Posted on October 24, 2020 by Alan

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,…

Read more
  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 42
  • Next

Search

Please Note

All the scripts are saved as .txt files. Newer files have a “View Script” button which will let you save or open a script in notepad. For earlier posts, the easiest way to download with IE is to right click on the link and use “Save Target As”. Rename file from Name_ext.txt to Name.ext.

To see a full post after searching, please click on the title.

PowerShell Scripts were written with version 3 or later.

https connections are supported.

All new users accounts must be approved, as are comments. Please be patient.  If you find a post error or a script which doesn’t work as expected, I appreciate being notified.  My email is my first name at the domain name, and you are welcome to contact me that way.

Tags

1E ACLS Active Directory ActiveDirectory ADSI Advanced Functions Audit Change Administrator Password COMObject Computer Groups DateTime Desktop DNS Excel FileScriptingObject Forms General GPO GPS Group Policy Hacks ISE Lockout logons NAV740 Nessus OU OU permissions Outlook Pick Folder Power PowerShell Powershell Scriptlets RDP SCCM schedule reboot Scripting Security Shell.Application user information VBA Windows Update WMI WordPress WPF

Categories

akaplan.com

  • Back to Home Page

Archives

Scripting Sites

  • A Big Pile of Small Things
  • Adam, the Automator
  • Art of the DBA
  • Ashley McGlone
  • Boe Prox
  • Carlo Mancini
  • DexterPOSH
  • Doug Finke
  • Jaap Brasser's Blog
  • JeffOps The Scripting Dutchman
  • Jonathan Medd's Blog
  • Keith Hill's Blog
  • LazyWinAdmin
  • Nana Lakshmanan
  • PowerShell Magazine
  • PowerShell Team Blog
  • PowerShell.org
  • PwrShell.net
  • Richard Siddaway's Blog
  • Ryan Yates' Blog
  • Skatterbrainz
  • The Lonely Administrator

SQL Site

  • Art of the DBA

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2025 Alan's Blog | Theme by SuperbThemes

Terms and Conditions - Privacy Policy