1

I'm willing to run Visio 2013 silently through PowerShell. At the moment I use the following code:

Add-Type -Path 'Microsoft.Office.Interop.Visio.dll'

$visio = New-Object Microsoft.Office.Interop.Visio.ApplicationClass
$visio.Visible = $false
$visio.Quit()

The code works but I briefly see the Visio splash screen before it is hidden. I would like to create the application object using Microsoft.Office.Interop.Visio.Application or Microsoft.Office.Interop.Visio.InvisibleApp but I can't find the right syntax.

Any help would be greatly appreciated.

Chris
  • 935
  • 3
  • 10
  • 21

1 Answers1

2

You can try this:

$visio = New-Object -ComObject Visio.InvisibleApp
$visio.Quit()

Note that it's not a must to use Add-Type (however you can go also with Add-Type, in this case try Microsoft.Office.Interop.Visio.InvisibleAppClass

BTW, there is a library for using Visio from PS: https://visioautomation.codeplex.com/

Nikolay
  • 10,752
  • 2
  • 23
  • 51
  • Thank you for helping, why do you say it's not a must tu use `Add-Type`? `New-Object Microsoft.Office.Interop.Visio.InvisibleAppClass` works fine and it is a call to a .NET interop. I assume using the .NET interop is better than using the COM object, am I wrong? – Chris Mar 11 '15 at 08:19
  • It's basically the same thing, just written differently - this way it's shorter :) – Nikolay Mar 11 '15 at 10:31