Alan's Blog

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

Menu
  • About My Blog
Menu

Author: Alan

See https://www.akaplan.com/about/

Not a Typewriter

Posted on September 2, 2017September 16, 2017 by Alan

Booting Linux in Safe Mode: “STDIn: Not a Typewriter” Linux programmers have a sense of humor. If Microsoft programmers do, it is rarely seen.

Read more

Add-WindowsFeature Alternative for Client OS

Posted on September 2, 2017September 23, 2017 by Alan

Waiting for the add remove features dialog populate on my client OS computer is slow.  Since I started using Add-WindowsFeature wither Server 2008, and Install-WindowsFeature beginning with Server 2012, I was disappointed by the lack of a similar cmdlet for Windows 10.  Unfortunately, Add/Install-WindowsFeature relies on ServerManager — which doesn’t exist on a workstation.  The…

Read more

Export and Import Delegated OU Permissions with PowerShell

Posted on August 13, 2017October 14, 2017 by Alan

There are some delegations of permissions within Active Directory which cannot be made without extra effort. Some properties are flagged as hidden in a file called Dssec.dat, in %windir%\System32 on computers with the Active Directory Users and Computers (ADUC) MMC. Dssec.dat is a hidden text file that can be viewed and modified with Notepad. When…

Read more

Clear GPO Cache on Remote Computer with PowerShell

Posted on August 13, 2017 by Alan

Clearing the GPO cache on a computer may be the only way to fix a persistent problem.  Doing this involves deleting files, registry entries, and rebuilding the security database.  Clear-GPOCache.ps1 works by creating a custom batch file on the remote computer, then scheduling a task running as System to run the process with the required…

Read more

Get and Read RDP Certificate from a Remote Host with PowerShell

Posted on August 13, 2017February 28, 2019 by Alan

Sometimes, I get some interesting questions from other teams within my organization.  Read-RDPCert.ps1 addresses a request to read the SSL certificates from a list of remote hosts.  This is based on the code and following comments at https://blogs.technet.microsoft.com/parallel_universe_-_ms_tech_blog/2014/06/26/reading-a-certificate-off-a-remote-ssl-server-for-troubleshooting-with-powershell/.

Read more

Enable New User Mailboxes with PowerShell

Posted on August 13, 2017 by Alan

Mail enabling new users should be easy to do from within the Exchange management console.  If you are in a really large organization, you soon discover that it is painfully slow.  When we create new users it takes time to replicate to Exchange, so we don’t mail enable new users upon creation.  Making matters worse…

Read more

Drag and Drop Form for Powershell

Posted on August 13, 2017May 18, 2019 by Alan

Get-DragAndDrop.ps1 is drag and drop PowerShell form is based on http://www.rlvision.com/blog/a-drag-and-drop-gui-made-with-powershell/.  All the interesting coding bits were written by Dan.  I modified the script to make it an advanced function which has parameters for the form title, instructions, status and button title.  The default form looks like this:

Read more

PowerShell Get Column Names for a CSV File

Posted on August 13, 2017 by Alan

Get-Member doesn’t always show you what is under the hood for an object.  For that you need the .PSObject property.  Here PSObject.Properties contains CSV column names $data = Import-Csv -Path $csvfile $ColNames = ($data[0].psobject.Properties).name $ColNames

Read more

Powershell Date LDAP filters

Posted on August 13, 2017 by Alan

This snippet can be used for easier date formatting when using an LDAP date filter with PowerShell.  This demonstrates how to get users created within the previous 30 days using LDAP: $MaxDays = 30 $StartDate = (Get-date).AddDays(-$MaxDays) #Set to begin at midnight $ldapStart = $StartDate.GetDateTimeFormats()[5].ToString().Replace(“-“,”)+’000000.0Z’ $LDAPFilter = “(WhenCreated>=$ldapStart)” Get-aduser -LDAPFilter $ldapfilter -properties whencreated  

Read more

PowerShell Pause with Progress Bar

Posted on August 13, 2017 by Alan

This snippet of PowerShell was written to have show users something more interesting than “Sleeping for 15 seconds” in a script.  Notice that I splat the progress parameters. #The math works only with seconds $pauseSecs = 1 $MaxWaitSecs =15 for ($i=0; $i -lt $MaxWaitSecs; $i+=$pauseSecs) { [int]$pct = ($i/$MaxWaitSecs)*100 $Params = @{ Activity = “Please…

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