Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

wmic command hanging powershell script

$
0
0

I wrote a script in powershell that is supposed to delete a printer on the local machine and while this command works, it also causes the powershell script to become unresponsive.  How do I actually run this command in powershell without it hanging the script?  If there is another way to delete a printer I am open to suggestions.  I tried several different ways though and either they don't have the delete method, they require admin privileges, or cause various other errors.  This wmic command is the only thing that seems to work.

 

I am very new to powershell so though I have tried to do this in strictly powershell, I have been unsuccessful.

wmic printer where "Name LIKE '$PrinterName'" delete


Viewing all articles
Browse latest Browse all 6937

Trending Articles