Alan's Blog

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

Menu
  • About My Blog
Menu

Tag: PowerShell

PowerShell and Process Owners

Posted on February 28, 2019 by Alan

If you are running as an administrator, it is easy to get the owner associated with a process using PowerShell: Get-Process -IncludeUserName. Get-Process gets information from System.Diagnostics.Process, not WMI. But you can get similar information from WMI, even if you aren’t an administrator. We had a little debate about this in our last Charlotte PowerShell…

Read more

Two Column WPF Form to Select Items or Properties

Posted on January 6, 2019September 12, 2020 by Alan

Many of my scripts are written for other people to do Active Directory reporting.  One of my goals in supporting them is to give them as much flexibility in the data returned with the minimum amount of custom coding required.   Convert-ADValues (which I will update soon), outputs friendly dates and expanded information for certificates,…

Read more

Convert CSV to Excel with Drag and Drop

Posted on September 16, 2018August 11, 2019 by Alan

Back in 2009, I published Convert CSV files to Excel, a vbscript which converts csv files to xlsx format.  Although there is not good way to directly support drag and drop with PowerShell, it can be done with a form.  Convert-DroppedCSVsToExcel.ps1 was mostly written as an exercise for me to work with drag and drop…

Read more

Get User Lockout Status with PowerShell

Posted on September 15, 2018September 15, 2018 by Alan

Get-UserLockoutStatus.ps1 is an interactive script to get the lockout status of a selected user or all users in a specified domain.  It queries each domain controller for non-replicated attributes using a workflow with an inline script for speed.  It requires the ActiveDirectory Module.

Read more

Is that String a Date?

Posted on September 2, 2018 by Alan

Test-IsDate is a simple function which tests a string to determine whether it is a date. function Test-IsDate([string]$sDate) { [boolean]($sDate -as [DateTime]) } Test-IsDate ‘Monday, August 13, 2018 1:28:48 PM’ returns True.

Read more

Create a Hash Table with AD Domain DNS Root and NetBIOS Names

Posted on September 2, 2018 by Alan

I frequently get requests to modify or lookup a list of user names in a CSV file where the username is NTDomain\SamAccountName.   Get-ADUser will let you use the NT domain as a server name, but in my experience it is slower than using the domain’s FQDN.  Before I import the list in my code, I…

Read more

Listing (and running) OS Shell Commands with PowerShell

Posted on September 2, 2018 by Alan

I think I started using Shell commands when I went looking for the startup folder in Windows 8.  A post from Jasone’s  MSDN blog suggested the easiest way to open it was by typing “Shell:Startup” in from the run box (WIN+R).  I became curious about how to enumerate a list of these shortcuts, and how…

Read more

Identify an AD object from the SID

Posted on September 2, 2018September 2, 2018 by Alan

Convert-SidToADObject will take an AD SID and return an object containing the object’s name, SamAccountName, Description, type and distinguished name. function Convert-SidToADObject($sid) { $u = [adsi](“LDAP://<SID=” + $sid + “>”) if ($u.SamAccountName) { [psCustomObject]@{ Name = $u.Name.value SamAccountName = $u.samAccountName.value Description = $u.description.value Type = $u.objectclass.Value[1] DistinguishedName = $u.distinguishedName.value } } Else { “Lookup Failed”…

Read more

Practical Lessons on WPF Forms and PowerShell

Posted on March 4, 2018March 4, 2018 by Alan

Last weekend I decided that I was finally going to figure out how to stop using Windows Forms, and move to the newer Windows Presentation Foundation (WPF).  Some time ago, I had read a WPF blog post from FoxDeploy.com, which shows how you can cut and past code from Windows Visual Studio into their code…

Read more

Delete User Profiles Interactively with PowerShell

Posted on October 22, 2017 by Alan

Last week, one of my administrators was complaining at how involved it was to remove a profile on a remote user’s computer. A little over two years ago, I wrote Delete Inactive Profiles, as a substitute for DelProf for post Windows XP OS.  That script is an advanced function, and was designed to remove stale…

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