Get-VisioDocument

Get all documents

Get-VisioDocument -Name *

Get all documents based on the document name

# To find a specific document with name "DocumentFoo"
Get-VisioDocument -Name "DocumentFoo"

Get the active document

Get-VisioDocument -ActiveDocument

Set the Active Document

# using a document object
Set-VisioDocument $doc

# Using the name the document
Set-VisioDocument "Drawing5"

Checking if the Active Document is valid

Sometimes you'll need to perform an action only if a drawing is open. The easy way to check is to use Test-VisioDocument

If (Test-VisioDocument)
{
    # do something
}
else
{
    # do something else
}

Last updated