Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How Can I Log Out a User if They Launch a Particular Application?

  Hey, Scripting Guy! I need to be able to use Windows PowerShell 2.0 to log a user out of their desktop machine if they launch a particular application. This is not for security reasons or to keep people from playing games. This is because we have a really dumb application that requires a specific user name and profile settings...

Hey, Scripting Guy! How Can I Have Files Copied to a USB Drive When the Drive Is Inserted into a Computer?

Hey, Scripting Guy! I would like to be able to use Windows PowerShell 2.0 to monitor for the insertion of a portable USB drive into a computer. When the drive is detected as having been added to the computer, I would like to have the script copy files to the USB drive. Is this possible?-- AJ Hello AJ, Microsoft Scripting Guy Ed ...

Hey, Scripting Guy! Can I Use WMI to Determine When Someone Logs Off a User or Shuts Down a Server?

  Hey, Scripting Guy! I have a Windows Server 2003 computer that I need to monitor for reboots. This may sound rather strange, but this server is more of a workstation, and we have a user mode application that runs under an actual user account. Therefore, we log on using the ID we have set up, launch the application, lock the console...

Hey, Scripting Guy! How Can I Retrieve Information About Laptops Changing from Full Power to Minimal Power Usage?

 Hey, Scripting Guy! I have a number of users on our network that use laptops as their primary workstation. These users are constantly complaining that their screen goes dark on them, or that the computer is running slow. I think the problem is the laptops switching between battery and AC power, or maybe the computer sensing that it is ...

Hey, Scripting Guy! How Can I Be Notified When a USB Drive Is Plugged into My Computer?

 Hey, Scripting Guy! I would like to be notified when I plug in a USB drive into my computer. I have some cool ideas for using that, but I do not know how to detect when a USB drive is plugged in. I know I can run a script that loops through looking for all drives, and compares them with a previous collection of drives and then looks ...