Alan's Blog

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

Menu
  • About My Blog
Menu

Tag: WMI

Manage Device on Remote Computer / List Connected USB Devices

Posted on December 26, 2021 by Alan

Remote access to the Plug and Play (PNP) RPC interface was removed in Windows 8, and since that time administrators have been unable to remotely manage Windows devices without RDP or a third party utility.  I haven’t been a desktop support person in years, and only recently learned about this, when troubleshooting a workstation with…

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

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

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

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

Get WMI Namespaces with PowerShell

Posted on February 28, 2019 by Alan

Here is a quick way to get a list of WMI namespaces on a computer using PowerShell.  Notice that this requires that you run it as an administrator. #Requires -RunAsAdministrator Function Get-WMINamespaceEnum ($NS) { Write-Output $ns Get-CimInstance “__Namespace” -Namespace $NS -ErrorAction SilentlyContinue | ForEach-Object { Get-WMINamespaceEnum “$ns\$($_.name)” } } #Example Get-WMINamespaceEnum ‘root’ | Sort-Object The…

Read more

Two Ways to Get Mapped Drives with WMI

Posted on March 3, 2018 by Alan

For years I have been getting mapped drives from WMI using Win32_NetworkConnection. Typical code looks like this in PowerShell: Get-CimInstance -ClassName ‘Win32_NetworkConnection’ | Select LocalName, RemotePath I have been using a product called ExpanDrive to map my cloud storage to drive letters.  When I tried to view the drives with Win32_NetworkConnection, I had no results….

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

Finding Rarely Used Computers On Your Network

Posted on February 13, 2016March 15, 2020 by Alan

I support a number of hospitals.  Many of these have very large facilities, where the placement of computers was originally done by a space planner or others trying to make an educated guess about how and where people would be working.  Frequently we find that there are computers which are unused or only rarely used. …

Read more

Win32_ReliablityRecords, PowerShell and ScriptoMatic

Posted on January 3, 2014March 9, 2015 by Alan

I was reviewing my blog stats today and found a link from a site in UK to my version of ScriptoMatic.hta.  I have upgraded my home laptop to 8.1, and decided to see whether it still works (it does).  If you launch the “fixed” ScriptoMatic as an ordinary user, it takes a very long time…

Read more
  • 1
  • 2
  • 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