Wednesday, November 25, 2015

PowerShell & Microsoft Word 2016 : Get the name of Active printer in Word 2016

 

In the previous blog  post, we have see that how can we enable / disable the view of the recent files.

If you have some users, those move from one regional office to other, and if they keep complaining about that their word is too slow and often crash while give print, then it's the issue with printer setup, they may have the  active printer which sits in another office which the user may visit once or often.

My task was to find the active printer in the Microsoft Word. I thought it may be difficult, but rather it was easy, I just need to use the ActivePrinter property of the our $word variable.

$word.ActivePrinter

 

Printer_1

 

Printer_0

That's all, the complete code is :

$word = New-Object -ComObject "Word.Application"

$word.Visible = $true

$word.ActivePrinter

 

Thanks for your time and see you in next blog post.

 

Aman Dhally - Manya Kaur

 

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

2 comments:

  1. Thanks! Unfortunately, I get an error with the first line. "80040154 Class not registered" How do you think I might solve that?

    ReplyDelete
    Replies
    1. Do you have office installed Rodney?

      Delete