title: Visio automation via PowerShell
body: <p>I have a script that automates the a Visio diagram, i based my script on the official Office site: <a href="http://gallery.technet.microsoft.com/office/f77fb025-11ee-48f3-8409-9bb567a63fc3" rel="nofollow">http://gallery.technet.microsoft.com/office/f77fb025-11ee-48f3-8409-9bb567a63fc3</a></p>
  
  <p>Well to be honest i have no idea how to retrieve the values of the "shape data", this shape data is for example (Serial number, Building, Location, etc...) from the pc stencil.
  I want to add and revise this values programatically, i ve checked the object model reference but without luck.</p>
  
  <p>Can someone help me? </p>
  
  <p>here is the code, it opens a visio document and adds a pc stencil to the drawing.</p>
  
  <pre><code>$application = New-Object -ComObject Visio.Application
  $application.visible = $true
  $documents = $application.Documents
  $document = $documents.Add("Basic Network Diagram.vst")
  $pages = $application.ActiveDocument.Pages
  $page = $pages.Item(1)
  
  
  $ComputerStencil = $application.Documents.Add("Computers and Monitors.vss")
  
  
  
  $pc = $ComputerStencil.Masters.Item("PC")
  $shape1 = $page.Drop($pc, 2.2, 6.8)
  $shape1.Text = "Some text...."
  </code></pre>
  
  <p>Thanxs for your time!!</p>