<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Hey, Scripting Guy! Can I Use WMI and Windows PowerShell to Make a Microsoft Visio Drawing?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/01/13/hey-scripting-guy-january-13-2010.aspx</link><description>Hey, Scripting Guy! Using Windows PowerShell to control Microsoft Visio looks really cool. However, if I have to manually enter all of the data in the script to produce the drawing, it is probably easier to open Microsoft Visio, drag and drop the shapes</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Hey, Scripting Guy! Can I Use WMI and Windows PowerShell to Make a Microsoft Visio Drawing?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/01/13/hey-scripting-guy-january-13-2010.aspx#3564585</link><pubDate>Wed, 10 Apr 2013 09:21:55 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3564585</guid><dc:creator>aaspnas</dc:creator><description>&lt;p&gt;Very useful indeed.&lt;/p&gt;
&lt;p&gt;For holding shape data i use an Excel file where a row contains the data for each shape, first row holding column headings. In Visio you can then add the shape data as a recordset:&lt;/p&gt;
&lt;p&gt;$pathToShapeData = &amp;quot;C:\Data\ShapeData.xlsx&amp;quot;&lt;/p&gt;
&lt;p&gt;$connection = &amp;quot;Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=$pathToShapeData;Mode=Read;&amp;quot; + &amp;#39;Extended Properties=&amp;quot;HDR=YES;IMEX=1;MaxScanRows=0;Excel 12.0;&amp;quot;;&amp;#39; + &amp;quot;Jet OLEDB:Engine Type=34;&amp;quot; ### Note, one long line...&lt;/p&gt;
&lt;p&gt;$command = &amp;quot;SELECT * FROM [Sheet1$]&amp;quot;&lt;/p&gt;
&lt;p&gt;$recordSet = $document.DataRecordsets.Add($connection, $command, 0, &amp;quot;ShapeData&amp;quot;) &lt;/p&gt;
&lt;p&gt;Once you have your recordset you can link your shapes to &amp;nbsp;the data:&lt;/p&gt;
&lt;p&gt;$shape.LinkToData($recordSet.ID , $recordsetRowID, $false)&lt;/p&gt;
&lt;p&gt;where &amp;nbsp;$recordsetRowID &amp;nbsp;corresponds to the c0 property value of the record.&lt;/p&gt;
&lt;p&gt;If the data changes in excel you can just refresh the data and have the shape properties reflect the updated value:&lt;/p&gt;
&lt;p&gt;$recordSet.Refresh() ### or do the refresh manually in Visio...&lt;/p&gt;
&lt;p&gt;For further reference see &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/ff767582%28v=office.14%29.aspx"&gt;msdn.microsoft.com/.../ff767582%28v=office.14%29.aspx&lt;/a&gt; and&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/ff766962%28v=office.14%29.aspx"&gt;msdn.microsoft.com/.../ff766962%28v=office.14%29.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3564585" width="1" height="1"&gt;</description></item><item><title>re: Hey, Scripting Guy! Can I Use WMI and Windows PowerShell to Make a Microsoft Visio Drawing?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/01/13/hey-scripting-guy-january-13-2010.aspx#3550449</link><pubDate>Tue, 05 Feb 2013 14:19:14 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3550449</guid><dc:creator>CarlosValdes</dc:creator><description>&lt;p&gt;Great tutorial!!!&lt;/p&gt;
&lt;p&gt;I would like to add some values to the shape data, for example on the pc stencil there are some values like (Serial number, room, building, etc...).&lt;/p&gt;
&lt;p&gt;Can I add some values programatically to this stencil?? How can i do it?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3550449" width="1" height="1"&gt;</description></item><item><title>re: Hey, Scripting Guy! Can I Use WMI and Windows PowerShell to Make a Microsoft Visio Drawing?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/01/13/hey-scripting-guy-january-13-2010.aspx#3305466</link><pubDate>Wed, 13 Jan 2010 16:29:29 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3305466</guid><dc:creator>MikeShepard</dc:creator><description>&lt;p&gt;I think there is a typo in the sript.&lt;/p&gt;
&lt;p&gt;This:&lt;/p&gt;
&lt;p&gt;$shape6.Text = &amp;quot;$(($networkinfo.IPAddress)[0])&amp;quot;&lt;/p&gt;
&lt;p&gt;Should have been this:&lt;/p&gt;
&lt;p&gt;$shape6.Text = &amp;quot;$($networkinfo[0].IPAddress)&amp;quot;&lt;/p&gt;
&lt;p&gt;That is, get the IP address of the first entry in the results from get-networkadapterconfiguration&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3305466" width="1" height="1"&gt;</description></item></channel></rss>