<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:evnet="http://www.mscommunities.com/rssmodule/"><channel><title>Entries tagged with scripting - TechNet Edge</title><atom:link rel="self" type="application/rss+xml" href="http://edge.technet.com/tags/scripting/rss/default.aspx" /><image><url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/Edge/images/feedimage.png</url><title>Entries tagged with scripting - TechNet Edge</title><link>http://edge.technet.com/Tags/Scripting/</link></image><description>scripting</description><link>http://edge.technet.com/Tags/Scripting/</link><language>en-us</language><pubDate>Tue, 18 Nov 2008 14:24:27 GMT</pubDate><lastBuildDate>Tue, 18 Nov 2008 14:24:27 GMT</lastBuildDate><generator>EvNet (EvNet, Version=1.0.3531.14011, Culture=neutral, PublicKeyToken=null)</generator><item><title>TechNet Radio:  PowerShell with the Powerscripting Podcast Guys</title><description>&lt;p&gt;Join us for this TechNet Radio session with special guests Jonathan Walz and Hal Rottenberg from the Powerscripting Podcast. We cover what is new in Windows PowerShell 2008 R2, emphasize why it is important for administrators to start learning PowerShell now, and point out some community resources for PowerShell users.&lt;/p&gt;&lt;img src="http://edge.technet.com/2123/WebViewBug.aspx?EVT=0" height="1" width="1" alt="" /&gt;</description><comments>http://edge.technet.com/Media/TechNet-Radio-PowerShell-with-the-Powerscripting-Podcast-Guys/</comments><link>http://edge.technet.com/Media/TechNet-Radio-PowerShell-with-the-Powerscripting-Podcast-Guys/</link><pubDate>Tue, 18 Nov 2008 14:24:00 GMT</pubDate><guid isPermaLink="false">http://download.microsoft.com/download/0/7/a/07a3461a-d7dc-4463-8844-9b7da69e5c1b/TechNetRadio11182008-web.wma</guid><evnet:views>1228</evnet:views><evnet:viewtrackingurl>http://edge.technet.com/2123/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Join us for this TechNet Radio session with special guests Jonathan Walz and Hal Rottenberg from the Powerscripting Podcast. We cover what is new in Windows PowerShell 2008 R2, emphasize why it is important for administrators to start learning PowerShell now, and point out some community resources for PowerShell users.</evnet:previewtext><media:group><media:content url="http://download.microsoft.com/download/0/7/a/07a3461a-d7dc-4463-8844-9b7da69e5c1b/TechNetRadio11182008-hi-web.mp3" expression="full" duration="1321" fileSize="7973692" type="audio/mp3" medium="audio" /><media:content isDefault="true" url="http://download.microsoft.com/download/0/7/a/07a3461a-d7dc-4463-8844-9b7da69e5c1b/TechNetRadio11182008-web.wma" expression="full" duration="1321" fileSize="5493055" type="audio/x-ms-wma" medium="audio" /></media:group><enclosure url="http://download.microsoft.com/download/0/7/a/07a3461a-d7dc-4463-8844-9b7da69e5c1b/TechNetRadio11182008-web.wma" length="5493055" type="audio/x-ms-wma" /><dc:creator>Eric Ostrowski</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://edge.technet.com/Media/TechNet-Radio-PowerShell-with-the-Powerscripting-Podcast-Guys/RSS/</wfw:commentRss><trackback:ping>http://edge.technet.com/2123/Trackback.aspx</trackback:ping><category>community</category><category>powershell</category><category>Scripting</category><category>TechNet Radio</category></item><item><title>Feature of the Week: Windows Server 2008 Hyper-V Scripting [Feature of the Week: Windows Server 2008 Hyper-V Scripting]</title><description>&lt;h4&gt;Virtualization is on everybody's mind — and with good reason. It's a critical, sea-changing concept with wide-reaching implications. The idea that you can make pools of dynamic resources with unlimited capacity available to users anywhere at any time is extraordinary.&lt;/h4&gt;
&lt;h5&gt;Because it is so vital, Microsoft&lt;sup&gt;®&lt;/sup&gt; is committed to driving the adoption of virtualization. However, unlike today's conventional wisdom, we don't view virtualization as an isolated, tactical tool. Rather, since virtualization can have a profound impact on your entire operation from the datacenter to the desktop, Microsoft believes it should be embraced as part of an enterprise-wide infrastructure strategy. &lt;/h5&gt;
&lt;p&gt;&lt;b&gt;Windows&lt;sup&gt;®&lt;/sup&gt; Management Instrumentation or &lt;/b&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394582.aspx"&gt;&lt;b&gt;WMI&lt;/b&gt;&lt;/a&gt;&lt;b&gt; is the essential underlying technology for managing Windows Server 2008 Hyper-V. WMI allows administrators and IT professionals full access to the Hyper-V stack.&lt;/b&gt;&lt;/p&gt;
&lt;h5&gt;Virtualization WMI Classes&lt;/h5&gt;
&lt;p&gt;Hyper-V does not expose a COM API for scripted management like previous products from Microsoft. Instead, Hyper-V is managed by working with WMI classes. Make sure to browse the MSDN section on the &lt;a href="http://msdn2.microsoft.com/en-us/library/cc136986(VS.85).aspx"&gt;virtualization WMI classes&lt;/a&gt; to become familiar with the different classes and their properties.&lt;/p&gt;
&lt;h5&gt;Software Requirements&lt;/h5&gt;
&lt;p&gt;For today’s Feature Of The Week we will use VBScript and PowerShell. In order to write VBScript code, you may use &lt;a href="http://www.primalscript.com/"&gt;PrimalScript&lt;/a&gt; by SAPIEN Technologies or your preferred editor Notepad. To write Windows PowerShell scriptlets, you must have at least &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx"&gt;Windows PowerShell 1.0&lt;/a&gt; installed. Windows PowerShell is an optional component for Windows Server 2008 and can be installed by using the "Add a Feature" option in Server Manager. Finally, for the VB.NET and Visual C# code snippets, you can use &lt;a href="http://www.microsoft.com/express"&gt;Visual Studio Express&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Ok, assuming you have these tools installed, let’s go ahead and start scripting!&lt;/p&gt;
&lt;h5&gt;Scripting Hyper-V with VBScript&lt;/h5&gt;
&lt;p&gt;In the examples we are going to expose, we will be doing very simple Hyper-V WMI querying. In this case, the script we want to write will list all of the Virtual Machines (VMs) running in a local Windows Hyper-V installation (you can find this script in the code snippets included with this newsletter).&lt;/p&gt;
&lt;p&gt;Here’s how you find the information using VBScript:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://edge.technet.com/Link/4e059548-8681-432b-9bbb-966f5c4ba594/"&gt;&lt;img width="645" height="287" alt="clip_image001" src="http://edge.technet.com/Link/1f5be674-b2cc-45f1-99ce-0d8dd2c61e60/" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The first line of the script sets the variable &lt;b&gt;strComputer&lt;/b&gt; to “.” which is used to specify the name of the server to query the WMI service (in this case, the local server). If you wanted to connect to a remote instance, then you would only need to change this to the name of the remote machine.&lt;/p&gt;
&lt;p&gt;The second line obtains the WMI service object from the virtualization namespace. The next section gets the name of the host on which this script is running, then queries for the Msvm_ComputerSystem object that represents the host. Since &lt;b&gt;ExecQuery() &lt;/b&gt;returns a collection, it is necessary to get the single object in the collection using a &lt;b&gt;For Each&lt;/b&gt; loop.&lt;/p&gt;
&lt;p&gt;After we have the host, we query for all Msvm_ComputerSystem objects associated with that host via Msvm_HostedDependency objects. These objects represent all the VMs running on that host. Finally, the foreach statement is responsible for displaying the &lt;b&gt;ElementName&lt;/b&gt; and &lt;b&gt;Caption&lt;/b&gt; properties of each virtual machine. Pretty straightforward, don’t you think?&lt;/p&gt;
&lt;h5&gt;Scripting Hyper-V with PowerShell&lt;/h5&gt;
&lt;p&gt;PowerShell has to be, without a doubt, one of the most useful — if not the most useful — scripting technologies on the Windows platform. Not only does it allow you to write powerful scripts but it also allows you to utilize .NET objects —something that VBScript cannot do. &lt;/p&gt;
&lt;p&gt;One of the key features of PowerShell is how easy it is to understand. It follows noun-verb syntax, and that makes the comprehension of scripts very straightforward. &lt;/p&gt;
&lt;p&gt;Let’s get back to our original example. If you recall, we wanted the script to output the names of the virtual machines with their installation date. The script to do this in PowerShell follows:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://edge.technet.com/Link/91674735-a1bb-4b4b-b38f-492176931a76/"&gt;&lt;img width="634" height="107" alt="clip_image002" src="http://edge.technet.com/Link/081fe796-b511-4042-b1b9-9b7a633caf6a/" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Just like in our previous example, the first line uses the &lt;b&gt;Get-WMIObject&lt;/b&gt; (which can be abbreviated as &lt;b&gt;gwmi&lt;/b&gt;) command to obtain the WMI object for the host in the virtualization namespace. A list of all Msvm_ComputerSystems is piped over to the next command. The &lt;b&gt;where&lt;/b&gt; clause is responsible for finding the parent partition — this is analogous to the if statement we introduced in the VBScript. Once again, we make a second WMI query to find all VMs hosted on this machine. Finally, the last line is used to display the elements &lt;b&gt;ElementName&lt;/b&gt; and &lt;b&gt;Caption&lt;/b&gt;. An example on what the output looks like in our test machine follows:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://edge.technet.com/Link/f57ce553-7cc5-40bb-bba5-c29e6d7653de/"&gt;&lt;img width="646" height="92" alt="clip_image003" src="http://edge.technet.com/Link/ecb96bf5-04dd-4618-a251-9e8070cb91bf/" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You will find that this is a lot easier than the VBScript solution. Reading the script and understanding is also easier than the VBScript solution; you could probably understand what the script is doing if you had never read the description on what it does.&lt;/p&gt;
&lt;p&gt;That’s it of this week’s FoW on Hyper-V scripting.&lt;/p&gt;&lt;p&gt;in reply to &lt;a href='http://edge.technet.com/Media/Feature-of-the-Week-Windows-Server-2008-Hyper-V-Scripting/'&gt;Feature of the Week: Windows Server 2008 Hyper-V Scripting&lt;/a&gt;&lt;/p&gt;&lt;img src="http://edge.technet.com/1965/WebViewBug.aspx?EVT=0" height="1" width="1" alt="" /&gt;</description><comments>http://edge.technet.com/Media/Feature-of-the-Week-Windows-Server-2008-Hyper-V-Scripting/</comments><link>http://edge.technet.com/Media/Feature-of-the-Week-Windows-Server-2008-Hyper-V-Scripting/</link><pubDate>Thu, 13 Nov 2008 17:59:00 GMT</pubDate><guid isPermaLink="false">http://edge.technet.com/Media/Feature-of-the-Week-Windows-Server-2008-Hyper-V-Scripting/</guid><evnet:views>17587</evnet:views><evnet:viewtrackingurl>http://edge.technet.com/1965/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Virtualization is on everybody's mind — and with good reason. It's a critical, sea-changing concept with wide-reaching implications. The idea that you can make pools of dynamic resources with unlimited capacity available to users anywhere at any time is extraordinary.</evnet:previewtext><dc:creator>Volker Will</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://edge.technet.com/Media/Feature-of-the-Week-Windows-Server-2008-Hyper-V-Scripting/RSS/</wfw:commentRss><trackback:ping>http://edge.technet.com/1965/Trackback.aspx</trackback:ping><category>Feature of the Week</category><category>Hyper-V</category><category>Scripting</category><category>Virtualization</category></item><item><title>Screencast:  Windows PowerShell introduction</title><description>&lt;img src="http://edge.technet.com/Link/26d6812e-d82d-4820-ba44-25f8074e68ab/" border="0" /&gt;Windows PowerShell is without a doubt one of the most important tools we have released for administrators for some time.&amp;nbsp; However it's often overlooked and a lot of IT Pro's I talk with think it's perhaps better suited to developers.&lt;br /&gt;
&lt;br /&gt;
In this Screencast I go through the basics to get you started.&amp;nbsp; I'll also post the sample files I've used at my blog which is &lt;a href="http://blogs.technet.com/jeffa36"&gt;http://blogs.technet.com/jeffa36&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Enjoy!&lt;br /&gt;
&lt;br /&gt;
jeffa&lt;img src="http://edge.technet.com/1486/WebViewBug.aspx?EVT=0" height="1" width="1" alt="" /&gt;</description><comments>http://edge.technet.com/Media/Screencast-Windows-PowerShell-introduction/</comments><link>http://edge.technet.com/Media/Screencast-Windows-PowerShell-introduction/</link><pubDate>Mon, 21 Jul 2008 22:34:00 GMT</pubDate><guid isPermaLink="false">http://edge.technet.com/Media/Screencast-Windows-PowerShell-introduction/</guid><evnet:views>35287</evnet:views><evnet:viewtrackingurl>http://edge.technet.com/1486/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Windows PowerShell is without a doubt one of the most important tools we have released for administrators for some time.&amp;nbsp; However it's often overlooked and a lot of IT Pro's I talk with think it's perhaps better suited to developers.

In this Screencast I go through the basics to get you&amp;#8230;</evnet:previewtext><media:thumbnail url="http://mschnlnine.vo.llnwd.net/d1/edge/6/8/4/1/WindowsPowershelljeffa_large_edge.jpg" height="240" width="320" /><media:thumbnail url="http://edge.technet.com/Link/da5a73e6-e17e-4d30-84e3-b23acc3c2887/" height="240" width="320" /><media:thumbnail url="http://edge.technet.com/Link/6239755e-5feb-45bc-9ad6-2a63889ad031/" height="240" width="320" /><media:thumbnail url="http://mschnlnine.vo.llnwd.net/d1/edge/6/8/4/1/UsingPowerShell_large_edge.jpg" height="240" width="320" /><media:thumbnail url="http://edge.technet.com/Link/26d6812e-d82d-4820-ba44-25f8074e68ab/" height="64" width="85" /><media:group><media:content url="http://mschnlnine.vo.llnwd.net/d1/edge/6/8/4/1/Powershell_jeffa.wmv" expression="full" duration="1181" type="video/x-ms-wmv" medium="video" /><media:content url="http://mschnlnine.vo.llnwd.net/d1/edge/6/8/4/1/Powershell_jeffa.wmv" expression="full" duration="1181" type="video/x-ms-wmv" medium="video" /><media:content url="http://mschnlnine.vo.llnwd.net/d1/edge/6/8/4/1/Using_Powershell_jeffa.wmv" expression="full" duration="1181" type="video/x-ms-wmv" medium="video" /><media:content url="http://mschnlnine.vo.llnwd.net/d1/edge/6/8/4/1/Powershell_jeffa.wmv" expression="full" duration="1181" fileSize="160044379" type="video/x-ms-wmv" medium="video" /></media:group><dc:creator>Jeff Alexander</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://edge.technet.com/Media/Screencast-Windows-PowerShell-introduction/RSS/</wfw:commentRss><trackback:ping>http://edge.technet.com/1486/Trackback.aspx</trackback:ping><category>Scripting</category><category>Windows PowerShell</category><category>Windows Server 2008</category><category>Windows Vista</category></item></channel></rss>