Alan's Blog

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

Menu
  • About My Blog
Menu

Reset GPO Cache

Posted on March 1, 2017 by Alan

This script deletes the locally stored copies of GPOs and forces a GPUPdate on a computer. Reset-GPOCache.ps1 works by a remote connection to the registry provider to get the path to the Group Policy\History folder, then deletes the files beneath that path. This ensures a fresh application of group polices.

Read more

Get Resultant Set of Polices (RSOP) with User Selection

Posted on March 1, 2017 by Alan

The Get-GPResultantSetOfPolicy cmdlet in the GroupPolicy module of PowerShell has a parameter for a user name.  Often I have no idea who has logged onto the computer.  Get-RSOP.ps1 uses WMI to give you a pick list of users on the remote computer and then passes that to the user parameter of Get-GPResultantSetOfPolicy.

Read more

Remove Active Directory Delegations

Posted on February 25, 2017February 25, 2024 by Alan

Over time, Active Directory delegations tend to accumulate and drift from the standards in the enterprise.  Removing the delegations for a user or group can be slow, especially if you do it manually.  Microsoft has a good article about this process, but none of the methods I found did what I needed.  I wanted a script which…

Read more

Get Downtime Using PowerShell

Posted on February 25, 2017 by Alan

I have been having problem with a computer with random reboots, and hanging on restart.  I wanted to know how long the computer had been unavailable.   I decided to use System Event ID 12 as the startup event for the purposes of my calculations.  The script takes these steps: 1) connect to the remote system…

Read more

Export to HTML with Style Sheet Header

Posted on February 25, 2017 by Alan

  $txtColor = ‘AliceBlue’ $file = “$env:temp\TempHTML.htm” $HTMLHeader =@” <style> BODY{background-color:white;} TABLE{border-width: 1px;border-style: solid;border-color: black; border-collapse: collapse;margin-left:auto; margin-right:auto;} TH{border-width: 1px;padding: 1px;border-style: solid; border-color: black;background-color:$txtColor} TD{border-width: 1px;padding: 1px;border-style: solid; border-color: black;background-color:$txtColor} </style> “@ #Example $title= ‘Service Information’ Get-Service | Select-Object Status, Name, DisplayName,Starttype | ConvertTo-HTML -head $HTMLHeader -body “<center><H2>$title</H2><Font=Verdana></Center>” | Out-File $file Invoke-Expression $file This a…

Read more

A Dot Source Reminder for Advanced Functions

Posted on February 25, 2017April 2, 2017 by Alan

One of the problems with writing advanced functions is that new PowerShell users think that they don’t do anything.  Frankly, I couldn’t figure out a way to get a notification to work, so I reached out to the sponsor for the Charlotte PowerShell User Group, Microsoft PFE Brian Wilhite. Brian sent me some code  which…

Read more

Fix User’s Home Directory Permissions with Take Ownership

Posted on February 15, 2017February 25, 2024 by Alan

Fix-HomeDrivePerms.ps1 is a PowerShell script which attempts to reset folder security when the permissions are really hosed.  It uses a take ownership function, Set-Owner, by Boe Prox, instead of takeown.exe, but does shell out to iCacls.exe.  I wrote this to fix home directories where a user might be logged on with files open a the…

Read more

Another User Folder Security Reset Script

Posted on February 11, 2017 by Alan

This simple batch file resets the inheritance on users folders and then grants them “modify” using the builtin icacls.exe.   This script does not address issues which require you to take ownership — I will post one that does that soon. @Echo Off Pushd \\path\USERS\ for /d %%u in (*.*) do echo ICACLS %%~fu /reset /t…

Read more

Set Share Folder Icon for Server 2012 and Windows 10

Posted on February 5, 2017 by Alan

I like to look at a folder and know whether or not it is shared. In earlier Windows OS there was a hand overlay which shows you this information. In Server 2012, this indicator has been omitted. Set-SharedFolderIcons.ps1 lets you use the icon of your choosing to restore this hint that a folder is shared.  …

Read more

Adding Terminal Services Information to User Reports

Posted on February 4, 2017October 14, 2017 by Alan

Add-ADTSInfo.ps1 adds TerminalServicesHomeDrive, TerminalServicesHomeDirectory, TerminalServicesProfilePath and AllowLogon as additional members returned by a query of Active Directory user objects.  As you may know, when looking at a user’s properties in the Active Directory Users and Computers MMC there is a tab for these fields.  However, if you look at the properties of a user object, these…

Read more
  • Previous
  • 1
  • …
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • …
  • 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