<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-36207740</id><updated>2025-11-10T04:10:32.110+01:00</updated><category term="powershell"/><category term="code"/><category term="conference"/><category term="CTP3"/><category term="TechEd"/><category term="registry"/><category term="script"/><category term="SID"/><category term="TEC2011"/><category term="TEE09"/><category term="TEE10"/><category term="WSUS"/><category term="basics"/><category term="deep dive"/><category term="download"/><category term="google"/><category term="gpo"/><category term="info"/><category term="interview"/><category term="linux"/><category term="podcast"/><category term="powerscripting podcast"/><category term="powershell ise"/><category term="powershell v2"/><category term="powershellplus"/><category term="profile"/><category term="security"/><category term="sysinternals"/><category term="v2"/><title type='text'>PowerShellers</title><subtitle type='html'>He who controls the shell, controls the universe.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-36207740.post-3699923454882026399</id><published>2011-10-14T15:36:00.000+02:00</published><updated>2011-10-14T15:36:36.444+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="conference"/><category scheme="http://www.blogger.com/atom/ns#" term="deep dive"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="TEC2011"/><title type='text'>The PowerShell Deep Dive USA 2011</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;While waiting for the PowerShell Deep Dive Europe, look at some of never-seen-before photos from &lt;a href=&quot;https://picasaweb.google.com/113697802432095788357/TEC2011ThePowerShellDeepDiveConferenceLasVegas&quot;&gt;the PowerShell Deep Dive USA&lt;/a&gt;, held in Las Vegas in April.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTZwFHmnhB2qPbxryF691WqwPqZLDI-TYgzYxEByGk98-hFbsa4Ze9FaWIrbtXpcXMWTlo8GN9zLT4m5JjBKyhGr0g1A3TiIA_1BHxGLQRZ3rbklPRJ9dZX_xufjuxHaoknch1/s1600/IMG_7361.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTZwFHmnhB2qPbxryF691WqwPqZLDI-TYgzYxEByGk98-hFbsa4Ze9FaWIrbtXpcXMWTlo8GN9zLT4m5JjBKyhGr0g1A3TiIA_1BHxGLQRZ3rbklPRJ9dZX_xufjuxHaoknch1/s320/IMG_7361.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
It’s not too late to sign up for the October 17 &amp;amp; 18 PowerShell Deep Dive:&lt;br /&gt;
&lt;br /&gt;
Go to the &lt;a href=&quot;https://register.crgevents.com/TECEurope2011/Register/Login/UsernamePassword/Default.aspx&quot;&gt;TEC registration page&lt;/a&gt;&lt;br /&gt;
Create an account. You need to do this again for TEC Europe, even if you attended TEC USA earlier this year.&lt;br /&gt;
Enter registration code: ATGNJR6E&lt;br /&gt;
Select “PowerShell Deep Dive” for the “Which conference do you plan to attend” question.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/3699923454882026399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/3699923454882026399' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/3699923454882026399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/3699923454882026399'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2011/10/powershell-deep-dive-usa-2011.html' title='The PowerShell Deep Dive USA 2011'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTZwFHmnhB2qPbxryF691WqwPqZLDI-TYgzYxEByGk98-hFbsa4Ze9FaWIrbtXpcXMWTlo8GN9zLT4m5JjBKyhGr0g1A3TiIA_1BHxGLQRZ3rbklPRJ9dZX_xufjuxHaoknch1/s72-c/IMG_7361.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-6984628108681257812</id><published>2010-11-22T21:26:00.002+01:00</published><updated>2010-11-22T22:02:04.440+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="conference"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="TechEd"/><category scheme="http://www.blogger.com/atom/ns#" term="TEE10"/><title type='text'>PowerShell Dinner at TechEd Europe 2010</title><content type='html'>&lt;p&gt;Another conference, another PowerShell Dinner... Here are the pictures from PowerShell Dinner we had at Teched Europe 2010. The dinner was a great event thanks to our hosts Dmitry Sotnikov and Kenneth Hansen, the iconic Jeffrey Snover and other members of PowerShell team, and a great group of old, new and future MVP guys.&lt;/p&gt;&lt;br /&gt;&lt;a href=&quot;http://goo.gl/photos/JVxLJ9hl5h&quot; imageanchor=&quot;1&quot; style=&quot;clear:right;margin-bottom:1em;margin-left:1em&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG-tDDhkdMMCXSp1tEAxTHsViyqQ8Q0jVrm1UGFH3sKs2ppsF518bt996xYxwLZ62h_FuCn-fCn9yXkTjxS1paYH1qi1tHvegBj4yjBEyoVKxP4Kf1zjpl4iQVt4g3h0EFcF7q/s512/IMG_6172.JPG&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Dmitry has chosen the same restaurant (Meineke X) as last year and we again enjoyed delicious traditional German food and beer. We&#39;ve missed Apfelstrudel, but Rote Grütze has saved the day. :) It is not an overstatement to say it was really one of the highlights of the year! You can see the whole &lt;a href=&quot;http://picasaweb.google.com/alexandair/PowerShellDinnerAtTechEdEurope2010#&quot;&gt;PowerShell Dinner at TechEd Europe 2010&lt;/a&gt; album.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/6984628108681257812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/6984628108681257812' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6984628108681257812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6984628108681257812'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2010/11/powershell-dinner-at-teched-europe-2010.html' title='PowerShell Dinner at TechEd Europe 2010'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG-tDDhkdMMCXSp1tEAxTHsViyqQ8Q0jVrm1UGFH3sKs2ppsF518bt996xYxwLZ62h_FuCn-fCn9yXkTjxS1paYH1qi1tHvegBj4yjBEyoVKxP4Kf1zjpl4iQVt4g3h0EFcF7q/s72-c/IMG_6172.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-791968885138808962</id><published>2009-11-23T09:31:00.003+01:00</published><updated>2009-11-23T10:56:06.591+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="conference"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="TechEd"/><category scheme="http://www.blogger.com/atom/ns#" term="TEE09"/><title type='text'>PowerShell Dinner at TechEd Europe 2009</title><content type='html'>Here are the pictures from PowerShell Dinner we had at Teched Europe 2009. The dinner was a great event thanks to our host Dmitry Sotnikov, the one and only Jeffrey Snover, amazing MVP guys, and a bunch of European PowerShellers.&lt;br /&gt;&lt;br /&gt;&lt;table style=&quot;width:auto;&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/sHULoGrO66zmVmjzFAxd3Q?feat=embedwebsite&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN1us4DW_tCLXwhrmidlIcVyudqxep_03QFx0hXRibgJOoQ8_8a8G6okB8MqkkdCE85cGb2dWt-1SsLggBCFWELWyvEhtdt-pOXqwxgX0vGM-T5q8-8deXKq3tj37V-a6Q7afo/s288/IMG_5452.JPG&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;font-family:arial,sans-serif; font-size:11px; text-align:right&quot;&gt;From &lt;a href=&quot;http://picasaweb.google.com/alexandair/PowerShellDinnerAtTechEdEurope2009?feat=embedwebsite&quot;&gt;PowerShell Dinner at TechEd Europe 2009&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;It was a great privilege to talk about PowerShell with fellow PowerShell addicts. And, let&#39;s not forget to mention delicous food and German beers. One of the highlights of the year! You can see the whole &lt;a href=&quot;http://picasaweb.google.com/alexandair/PowerShellDinnerAtTechEdEurope2009#&quot;&gt;PowerShell Dinner at TechEd Europe 2009&lt;/a&gt; album.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/791968885138808962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/791968885138808962' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/791968885138808962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/791968885138808962'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2009/11/powershell-dinner-at-teched-europe-2009.html' title='PowerShell Dinner at TechEd Europe 2009'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN1us4DW_tCLXwhrmidlIcVyudqxep_03QFx0hXRibgJOoQ8_8a8G6okB8MqkkdCE85cGb2dWt-1SsLggBCFWELWyvEhtdt-pOXqwxgX0vGM-T5q8-8deXKq3tj37V-a6Q7afo/s72-c/IMG_5452.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-8664422544128923665</id><published>2009-10-15T20:54:00.006+02:00</published><updated>2009-10-15T22:08:08.616+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell v2"/><category scheme="http://www.blogger.com/atom/ns#" term="registry"/><category scheme="http://www.blogger.com/atom/ns#" term="WSUS"/><title type='text'>PowerShell V2: Meet New-Object&#39;s Property parameter</title><content type='html'>&lt;p&gt;I&#39;ve stumbled upon &lt;a href=&quot;http://www.resourcefuladmin.com/2009/09/remote-windows2003-registry-and-powershell/&quot;&gt;blog post&lt;/a&gt; that talks about accessing remote registry, collecting &quot;Automatic Update&quot; configuration info and creating custom object to hold that data for further processing/formatting.&lt;/br&gt;&lt;br /&gt;The author has used Add-Member cmdlet to add quite a bunch of NoteProperties to the custom object. In PowerShell V2 we can do it in much cleaner way, with less typing, using new New-Object&#39;s &lt;strong&gt;Property&lt;/strong&gt; parameter that expects a hash table as a value, a hash table in which the keys are the names of properties or methods and the values are property values or method arguments.&lt;/p&gt;&lt;br /&gt;Let&#39;s rewrite a function.&lt;br /&gt;&lt;pre&gt;function Get-WSUSRegKey {&lt;br /&gt;   [CmdletBinding()]&lt;br /&gt;   param (&lt;br /&gt;      [parameter(ValueFromPipeline=$true)]&lt;br /&gt;      [String[]]$ComputerName = $env:computername&lt;br /&gt;   )&lt;br /&gt;&lt;br /&gt;   PROCESS {&lt;br /&gt;      $ComputerName | ForEach-Object {&lt;br /&gt;      # open remote registry key&lt;br /&gt;      $rootKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(&#39;LocalMachine&#39;,$_)&lt;br /&gt;      # open subkey WindowsUpdate and its subkey AU&lt;br /&gt;      $regKey0 = $rootKey.OpenSubKey(&quot;Software\policies\Microsoft\Windows\WindowsUpdate\&quot;)&lt;br /&gt;      $regKey1 = $rootKey.OpenSubKey(&quot;Software\policies\Microsoft\Windows\WindowsUpdate\&quot; + $($regKey0.GetSubKeyNames()))&lt;br /&gt;&lt;br /&gt;      # create an empty hash table&lt;br /&gt;      $ht = @{}&lt;br /&gt;      # enumerate value names in both subkeys and populate hash table with name/value pairs &lt;br /&gt;      $regKey0.GetValueNames() | ForEach-Object {$ht.$_ = $regKey0.GetValue($_)}&lt;br /&gt;      $regKey1.GetValueNames() | ForEach-Object {$ht.$_ = $regKey1.GetValue($_)}&lt;br /&gt;      # this will add ComputerName NoteProperty to our object&lt;br /&gt;      $ht.ComputerName = $_&lt;br /&gt;      # and finally, create an object using the data stored in a hash table&lt;br /&gt;      New-Object PSObject -Property $ht&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Two usage examples:&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;&lt;br /&gt;PS C:\&gt; $servers = &#39;server1&#39;,&#39;server2&#39;,&#39;server3&#39;&lt;br /&gt;PS C:\&gt; Get-WSUSRegKey -ComputerName $servers&lt;br /&gt;PS C:\&gt; $servers | Get-WSUSRegKey | Format-Table ComputerName,WUServer&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/8664422544128923665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/8664422544128923665' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/8664422544128923665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/8664422544128923665'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2009/10/powershell-v2-meet-new-objects-property.html' title='PowerShell V2: Meet New-Object&#39;s Property parameter'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-442630280936551108</id><published>2009-06-11T20:34:00.004+02:00</published><updated>2009-06-11T20:59:10.199+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="registry"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><category scheme="http://www.blogger.com/atom/ns#" term="SID"/><category scheme="http://www.blogger.com/atom/ns#" term="sysinternals"/><title type='text'>How to get computer SID using PowerShell</title><content type='html'>Let&#39;s start with the theory. ;)&lt;br /&gt;&lt;br /&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_SID#Machine_SIDs&quot;&gt;computer SID&lt;/a&gt; is stored in the HKEY_LOCAL_MACHINE\SECURITY\SAM\Domains\Account Registry subkey. This key has a value named F and a value named V. The V value is a binary value that has the computer SID embedded within it at the end of its data. This SID is in a standard format (3 32-bit subauthorities preceded by three 32-bit authority fields).&lt;br /&gt;&lt;br /&gt;Because you can&#39;t see the SECURITY hive&#39;s contents by default (even as an administrator), you need a little trick. &lt;strong&gt;Use &lt;em&gt;at&lt;/em&gt; command to schedule the startup of PowerShell.&lt;/strong&gt; Make sure that you schedule the task as Interactive and that the Scheduler service runs in the security context of the System (aka LocalSystem) account because this account—unlike a regular user account—has privileges to view the SAM and SECURITY hives.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;unixcode&quot;&gt;c:\&gt; at TIME /interactive powershell.exe&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;PS&gt; $key = Get-Item HKLM:\security\sam\domains\account&lt;br /&gt;PS&gt; $values = Get-ItemProperty $key.pspath&lt;br /&gt;PS&gt; $bytearray = $values.V&lt;br /&gt;PS&gt; New-Object System.Security.Principal.SecurityIdentifier($bytearray[272..295],0) | Format-List *&lt;br /&gt;&lt;br /&gt;BinaryLength     : 24&lt;br /&gt;AccountDomainSid : S-1-5-21-796845957-602608370-839522115&lt;br /&gt;Value            : S-1-5-21-796845957-602608370-839522115&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can check your result with Sysinternals&#39; &lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb897417.aspx&quot;&gt;PsGetSid&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;PS&gt; .\psgetsid.exe &lt;br /&gt;&lt;br /&gt;SID for \\COMPUTER:&lt;br /&gt;S-1-5-21-796845957-602608370-839522115&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/442630280936551108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/442630280936551108' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/442630280936551108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/442630280936551108'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2009/06/how-to-get-computer-sid-using.html' title='How to get computer SID using PowerShell'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-4643649477000687340</id><published>2009-05-03T21:56:00.007+02:00</published><updated>2009-08-01T13:59:15.227+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell ise"/><category scheme="http://www.blogger.com/atom/ns#" term="v2"/><title type='text'>What happened to a CustomMenu property?</title><content type='html'>If you&#39;d like to customize your Windows PowerShell ISE be prepared for some breaking changes in Windows PowerShell ISE that comes with Windows 7 RC (May I call it Windows PowerShell ISE RC?). In Windows PowerShell ISE CTP3 $psISE, custom host variable, has following properties:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;PS C:\&gt; $psISE | gm -MemberType property&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   TypeName: System.Management.Automation.Host.PSGHost&lt;br /&gt;&lt;br /&gt;Name                  MemberType Definition                                                                      &lt;br /&gt;----                  ---------- ----------                                                                      &lt;br /&gt;CurrentOpenedFile     Property   System.Management.Automation.Host.OpenedFile CurrentOpenedFile {get;}           &lt;br /&gt;CurrentOpenedRunspace Property   System.Management.Automation.Host.OpenedRunspace CurrentOpenedRunspace {get;}   &lt;br /&gt;CustomMenu            Property   System.Management.Automation.Host.PSMenuItem CustomMenu {get;}                  &lt;br /&gt;OpenedRunspaces       Property   System.Management.Automation.Host.OpenedRunspaceCollection OpenedRunspaces {get;}&lt;br /&gt;Options               Property   System.Management.Automation.Host.Options Options {get;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Same command in Windows PowerShell ISE RC will give renamed type and properties:&lt;br /&gt;&lt;br /&gt;   &lt;pre&gt;TypeName: Microsoft.PowerShell.Host.ISE.ObjectModelRoot&lt;br /&gt;&lt;br /&gt;Name                 MemberType Definition                                                                &lt;br /&gt;----                 ---------- ----------                                                                &lt;br /&gt;CurrentFile          Property   Microsoft.PowerShell.Host.ISE.ISEFile CurrentFile {get;}                  &lt;br /&gt;CurrentPowerShellTab Property   Microsoft.PowerShell.Host.ISE.PowerShellTab CurrentPowerShellTab {get;}   &lt;br /&gt;Options              Property   Microsoft.PowerShell.Host.ISE.ISEOptions Options {get;}                   &lt;br /&gt;PowerShellTabs       Property   Microsoft.PowerShell.Host.ISE.PowerShellTabCollection PowerShellTabs {get;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Runspace is PowerShell Tab now, and &lt;span style=&quot;font-style: italic;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;Opened&lt;/span&gt; was unnecessary, but what happened to a CustomMenu property?&lt;br /&gt;&lt;br /&gt;Let&#39;s see what CurrentPowerShellTab can offer:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&lt;/span&gt;&lt;pre&gt;PS C:\&gt; $psISE.CurrentPowerShellTab | gm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   TypeName: Microsoft.PowerShell.Host.ISE.PowerShellTab&lt;br /&gt;&lt;br /&gt;Name            MemberType Definition                                                                                                 &lt;br /&gt;----            ---------- ----------                                                                                                 &lt;br /&gt;...             ...        ...&lt;br /&gt;                                                                                        &lt;br /&gt;AddOnsMenu      Property   Microsoft.PowerShell.Host.ISE.ISEMenuItem AddOnsMenu {get;}&lt;br /&gt;...             ...        ...&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It looks that we are on a right track. We used to run a command such as the following one to add customized menu item:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$psISE.CustomMenu.Submenus.Add(&quot;Run single line&quot;, {Invoke-CaretLine} , &#39;F7&#39;)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So, what we are looking for is a Submenus property. Let&#39;s hope that an AddOnsMenu has one. :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;PS C:\&gt; $psise.CurrentPowerShellTab.AddOnsMenu | gm -MemberType property&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   TypeName: Microsoft.PowerShell.Host.ISE.ISEMenuItem&lt;br /&gt;&lt;br /&gt;Name        MemberType Definition                                                                                                     &lt;br /&gt;----        ---------- ----------&lt;br /&gt;                                                                                       &lt;br /&gt;Action      Property   System.Management.Automation.ScriptBlock Action {get;}                                                       &lt;br /&gt;DisplayName Property   System.String DisplayName {get;}                                                                             &lt;br /&gt;Shortcut    Property   System.Windows.Input.KeyGesture Shortcut {get;}                                                              &lt;br /&gt;Submenus    Property   System.Collections.Generic.IList`1[[Microsoft.PowerShell.Host.ISE.ISEMenuItem...&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Bingo!&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;PS C:\&gt; $psise.CurrentPowerShellTab.AddOnsMenu.Submenus | gm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   TypeName: Microsoft.PowerShell.Host.ISE.ISEMenuItem&lt;br /&gt;&lt;br /&gt;Name        MemberType Definition                                                                                                     &lt;br /&gt;----        ---------- ----------                                                                                                     &lt;br /&gt;Equals      Method     bool Equals(System.Object obj)                                                                               &lt;br /&gt;GetHashCode Method     int GetHashCode()                                                                                            &lt;br /&gt;GetType     Method     type GetType()                                                                                               &lt;br /&gt;ToString    Method     string ToString()                                                                                            &lt;br /&gt;Action      Property   System.Management.Automation.ScriptBlock Action {get;}                                                       &lt;br /&gt;DisplayName Property   System.String DisplayName {get;}                                                                             &lt;br /&gt;Shortcut    Property   System.Windows.Input.KeyGesture Shortcut {get;}                                                              &lt;br /&gt;Submenus    Property   System.Collections.Generic.IList`1[[Microsoft.PowerShell.Host.ISE.ISEMenuItem...&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;What the fluff?! Where is an Add method?&lt;br /&gt;As we have learnt in V1, when you miss some member use a psbase property:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;PS C:\&gt; $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.psbase | gm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   TypeName: System.Management.Automation.PSMemberSet&lt;br /&gt;&lt;br /&gt;Name              MemberType            Definition                                                                                    &lt;br /&gt;----              ----------            ----------                                                                                    &lt;br /&gt;CollectionChanged Event                 System.Collections.Specialized.NotifyCollectionChangedEventHandler CollectionChanged(System....&lt;br /&gt;Add               Method                Microsoft.PowerShell.Host.ISE.ISEMenuItem Add(string displayName, scriptblock action,...&lt;br /&gt;Clear             Method                System.Void Clear()                                                                         &lt;br /&gt;Contains          Method                bool Contains(Microsoft.PowerShell.Host.ISE.ISEMenuItem item)                               &lt;br /&gt;CopyTo            Method                System.Void CopyTo(Microsoft.PowerShell.Host.ISE.ISEMenuItem[] array, int arrayIndex)       &lt;br /&gt;Equals            Method                bool Equals(System.Object obj)                                                              &lt;br /&gt;GetEnumerator     Method                System.Collections.Generic.IEnumerator[Microsoft.PowerShell.Host.ISE.ISEMenuItem]&lt;br /&gt;GetHashCode       Method                int GetHashCode()                                                                           &lt;br /&gt;GetType           Method                type GetType()                                                                              &lt;br /&gt;IndexOf           Method                int IndexOf(Microsoft.PowerShell.Host.ISE.ISEMenuItem item)                                 &lt;br /&gt;Insert            Method                System.Void Insert(int index, Microsoft.PowerShell.Host.ISE.ISEMenuItem item)               &lt;br /&gt;Remove            Method                bool Remove(Microsoft.PowerShell.Host.ISE.ISEMenuItem item)                                 &lt;br /&gt;RemoveAt          Method                System.Void RemoveAt(int index)                                                             &lt;br /&gt;ToString          Method                string ToString()                                                                           &lt;br /&gt;Item              ParameterizedProperty Microsoft.PowerShell.Host.ISE.ISEMenuItem Item(int index) {get;set;}                        &lt;br /&gt;Count             Property              System.Int32 Count {get;}                                                                   &lt;br /&gt;IsReadOnly        Property              System.Boolean IsReadOnly {get;} &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That&#39;s much better. :)&lt;br /&gt;&lt;br /&gt;Now it&#39;s easy to add our first customized menu item:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$action = {$p = Read-Host &quot;Enter parameter name&quot;;Get-Help * -parameter $p}&lt;br /&gt;$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(&quot;Find parameter&quot;,$action,&#39;Ctrl+Shift+F3&#39;)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If we want to create a submenu, we need to omit an action:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$m = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(&quot;Execution Policy&quot;,$null,$null)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And then we can add the menu items:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$m.Submenus.Add(&quot;Get policy&quot;,{Get-ExecutionPolicy},&#39;CTRL+Shift+J&#39;)&lt;br /&gt;$m.Submenus.Add(&quot;Set policy&quot;,{Set-ExecutionPolicy RemoteSigned},&#39;CTRL+Shift+K&#39;)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;These changes are not persistent, and we will loose them when we close Windows PowerShell ISE. We can really extend our environment by putting the code into our Windows PowerShell ISE profile.&lt;br /&gt;&lt;br /&gt;To summarize, Windows PowerShell ISE can have up to 8 PowerShell Tabs, and every tab can have its own set of customized menu items and submenus.&lt;br /&gt;&lt;br /&gt;While we talk about changes in a new Windows PowerShell ISE, let&#39;s not forget that some shorcuts are changed as well (Run Selection is F8 now) and new toolbar is common for all three panes. The best new built-in menu item is the &lt;span style=&quot;font-style: italic;&quot;&gt;New Remote PowerShell Tab...&lt;/span&gt; which will start an interactive session with a remote computer.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/4643649477000687340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/4643649477000687340' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4643649477000687340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4643649477000687340'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2009/05/what-happened-to-custommenu-property.html' title='What happened to a CustomMenu property?'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-1914227745265994790</id><published>2009-05-02T23:45:00.002+02:00</published><updated>2009-05-02T23:53:54.783+02:00</updated><title type='text'>Upgrade Virtual PC 2007 before you virtualize Windows 7 RC</title><content type='html'>If you plan to install Windows 7 RC using Microsoft Virtual PC 2007, upgrade it to &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=28c97d22-6eb8-4a09-a7f7-f6c7a1f000b5&amp;displaylang=en&quot;&gt;Virtual PC 2007 SP1&lt;/a&gt; (6.0.192.0). Old version (6.0.156.0) will give you BSOD after you install Virtual Machine Additions (Error: Fs_Rec.sys - The driver mistakenly marked a part of its image pagable instead of nonpagable.)&lt;br /&gt;Happily, System Restore works great. :)</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/1914227745265994790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/1914227745265994790' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1914227745265994790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1914227745265994790'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2009/05/upgrade-virtual-pc-2007-before-you.html' title='Upgrade Virtual PC 2007 before you virtualize Windows 7 RC'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-1600023839570996427</id><published>2009-02-17T13:28:00.016+01:00</published><updated>2009-02-17T13:58:52.415+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="CTP3"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>Get-Alias ?</title><content type='html'>&lt;p&gt;If you want to find the cmdlet &amp;quot;behind&amp;quot; the alias &lt;em&gt;?&lt;/em&gt;, command &lt;em&gt;Get-Alias ?&lt;/em&gt; won&#39;t help you, because &lt;em&gt;?&lt;/em&gt; will be treated as a wildcard for a single character, and you will get all single-character aliases:&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;PS&amp;gt;get-alias ? &lt;/p&gt;&lt;p class=&quot;code&quot;&gt;CommandType &amp;#160;Name&amp;#160;&amp;#160;&amp;#160; Definition   &lt;br /&gt;-----------&amp;#160; ----&amp;#160;&amp;#160;&amp;#160; ----------    &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; %&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ForEach-Object    &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ?&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Where-Object    &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; h&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Get-History    &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; r&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Invoke-History&lt;/p&gt;  &lt;p&gt;   &lt;p&gt;&lt;/p&gt; To use &lt;em&gt;?&lt;/em&gt; as the literal value, you have to escape it with a backtick and put it in &lt;strong&gt;single quotes&lt;/strong&gt;:&lt;p class=&quot;code&quot;&gt;PS&amp;gt;get-alias &#39;`?&#39;&amp;#160; &lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;CommandType &amp;#160;Name&amp;#160;&amp;#160;&amp;#160; Definition   &lt;br /&gt;-----------&amp;#160; ----&amp;#160;&amp;#160;&amp;#160; ----------    &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ?&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Where-Object&lt;/p&gt;&lt;p&gt;Double quotes don&#39;t work in both V1 and V2 CTP3. Does somebody know why? &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/1600023839570996427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/1600023839570996427' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1600023839570996427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1600023839570996427'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2009/02/get-alias.html' title='Get-Alias ?'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-4927204979048456242</id><published>2009-02-06T02:00:00.004+01:00</published><updated>2009-02-06T08:52:32.252+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="CTP3"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>Do you know the aliases for the New-Item cmdlet?</title><content type='html'>I was playing with Doug Finke&#39;s extensions for PowerShell ISE (Integrated Scripting Environment), &lt;a href=&quot;http://dougfinke.com/blog/index.php/2009/02/03/powershell-ise-cream/&quot;&gt;Expand-Alias and Expand-CurrentAlias&lt;/a&gt;, when I&#39;ve noticed that &lt;em&gt;mkdir&lt;/em&gt; doesn&#39;t expand and &lt;em&gt;md&lt;/em&gt; expands to &lt;em&gt;mkdir&lt;/em&gt;. Up until now I thought that &lt;em&gt;mkdir&lt;/em&gt; and &lt;em&gt;md&lt;/em&gt; are aliases for the &lt;em&gt;New-Item&lt;/em&gt; cmdlet as &lt;em&gt;rmdir&lt;/em&gt; and &lt;em&gt;rd&lt;/em&gt; are the aliases for the &lt;em&gt;Remove-Item&lt;/em&gt; cmdlet.   &lt;br /&gt;  &lt;br /&gt;In both PowerShell V1 and V2 CTP3:   &lt;br /&gt;  &lt;br /&gt;  &lt;p class=&quot;code&quot;&gt;PS&amp;gt; get-alias | ? {$_.definition -eq &#39;remove-item&#39;}    &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;CommandType Name&amp;#160; Definition    &lt;br /&gt;----------- ----&amp;#160; ----------     &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ri&amp;#160;&amp;#160;&amp;#160; Remove-Item     &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rm&amp;#160;&amp;#160;&amp;#160; Remove-Item     &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rmdir Remove-Item     &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; del&amp;#160;&amp;#160; Remove-Item     &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; erase Remove-Item     &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rd&amp;#160;&amp;#160;&amp;#160; Remove-Item&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;   &lt;br /&gt;    &lt;br /&gt;PS&amp;gt; get-alias | ? {$_.definition -eq &#39;new-item&#39;}     &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;CommandType Name Definition    &lt;br /&gt;----------- ---- ----------     &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ni&amp;#160;&amp;#160; New-Item     &lt;br /&gt;&lt;/p&gt;  &lt;br /&gt;&lt;strong&gt;Where are the mkdir and md?&lt;/strong&gt;   &lt;br /&gt;  &lt;br /&gt;The &lt;em&gt;mkdir&lt;/em&gt; and &lt;em&gt;md&lt;/em&gt; are built-in functions in PowerShell V1 with the same definition:   &lt;br /&gt;  &lt;br /&gt;  &lt;p class=&quot;code&quot;&gt;PS&amp;gt; gci function: | ? {$_.name -like &#39;m*d*&#39;} | ft -auto    &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;CommandType Name&amp;#160; Definition    &lt;br /&gt;----------- ----&amp;#160; ----------     &lt;br /&gt;Function&amp;#160;&amp;#160;&amp;#160; mkdir param([string[]]$paths); New-Item -type directory -path $paths     &lt;br /&gt;Function&amp;#160;&amp;#160;&amp;#160; md&amp;#160;&amp;#160;&amp;#160; param([string[]]$paths); New-Item -type directory -path $paths     &lt;br /&gt;&lt;/p&gt;  &lt;br /&gt;The things are different in PowerShell V2 CTP3. The &lt;em&gt;mkdir&lt;/em&gt; command is still a function, but with much more complex definition, and &lt;em&gt;md&lt;/em&gt; is an alias for &lt;em&gt;mkdir&lt;/em&gt;.   &lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;p class=&quot;code&quot;&gt;PS&amp;gt; gci function: | ? {$_.name -like &#39;m*d*&#39;}    &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;CommandType Name&amp;#160; Definition    &lt;br /&gt;----------- ----&amp;#160; ----------     &lt;br /&gt;Function&amp;#160;&amp;#160;&amp;#160; mkdir ...     &lt;br /&gt;    &lt;br /&gt;PS&amp;gt; get-alias md     &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;CommandType Name Definition   &lt;br /&gt;----------- ---- ----------    &lt;br /&gt;Alias&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; md&amp;#160;&amp;#160; mkdir&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;To see the code behind &lt;em&gt;mkdir&lt;/em&gt; command type:     &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;code&quot;&gt;PS&amp;gt; gc function:\mkdir&lt;/p&gt;  &lt;br /&gt;  &lt;br /&gt;Very nice example of an advanced function.  </content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/4927204979048456242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/4927204979048456242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4927204979048456242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4927204979048456242'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2009/02/do-you-know-aliases-for-new-item-cmdlet.html' title='Do you know the aliases for the New-Item cmdlet?'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-6557022540747830257</id><published>2008-11-10T14:17:00.005+01:00</published><updated>2008-11-10T14:28:40.640+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>-include and -exclude go together</title><content type='html'>While reading James Brundage&#39;s blog post &lt;a href=&quot;http://blogs.msdn.com/mediaandmicrocode/archive/2008/11/08/microcode-exploring-more-of-net-with-get-assembly.aspx&quot;&gt;Microcode: Exploring More of .NET with Get-Assembly&lt;/a&gt;, I have spotted a rather unnecessary complicated part of a code:&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;Get-ChildItem (Join-Path $env:Windir &quot;Assembly&quot;) -recurse -filter &quot;*.dll&quot; |&lt;br /&gt;        Where-Object {&lt;br /&gt;            ! $_.Name.Substring(0,$_.Name.IndexOf($_.Extension)).EndsWith(&quot;.ni&quot;)&lt;br /&gt;        }&lt;/p&gt;&lt;br /&gt;The goal was to remove from the list of the DLLs those files named something like AssemblyName.Ni.Dll, because they cannot be loaded. At first I thought this is the right job for a -notlike operator:&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;Get-ChildItem (Join-Path $env:Windir &quot;Assembly&quot;) -recurse -filter &quot;*.dll&quot; |&lt;br /&gt; Where-Object {$_.name -notlike &quot;*.ni.*&quot;}&lt;/p&gt;&lt;br /&gt;It&#39;ll do the job and it&#39;s much cleaner (and simpler).&lt;br /&gt;&lt;br /&gt;On the other hand, Get-ChildItem has an -exclude parameter. It must be faster than piping to Where-Object. Why not use that instead? To my surprise the combination of -filter and -exclude parameters produced totally wrong result.&lt;br /&gt;&lt;br /&gt;Fortunately, Get-ChildItem has an -include parameter too, which can be used instead of a -filter in this case (hat tip to &lt;a href=&quot;http://huddledmasses.org/&quot;&gt;Joel &#39;Jaykul&#39; Bennett&lt;/a&gt;). So, the final command is:&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;Get-ChildItem (Join-Path $env:Windir &quot;Assembly&quot;) -recurse -include &quot;*.dll&quot; -exclude &quot;*.ni.*&quot;&lt;/p&gt;&lt;br /&gt;Isn&#39;t that easier to write (and probably faster to execute)?</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/6557022540747830257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/6557022540747830257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6557022540747830257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6557022540747830257'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2008/11/include-and-exclude-go-together.html' title='-include and -exclude go together'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-6470173626017639101</id><published>2008-10-06T16:29:00.001+02:00</published><updated>2008-10-06T16:33:12.182+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="interview"/><category scheme="http://www.blogger.com/atom/ns#" term="podcast"/><category scheme="http://www.blogger.com/atom/ns#" term="powerscripting podcast"/><category scheme="http://www.blogger.com/atom/ns#" term="powershellplus"/><title type='text'>An interview with Tobias Weltner</title><content type='html'>For those of you who have missed it when it was &lt;a href=&quot;http://www.ustream.tv/channel/powerscripting-podcast&quot;&gt;broadcasted live&lt;/a&gt;, new episode of famous &lt;a href=&quot;http://powerscripting.wordpress.com/&quot;&gt;PowerScripting Podcast&lt;/a&gt; is online and ready for listening. In &lt;a href=&quot;http://powerscripting.wordpress.com/2008/10/05/episode-44-tobias-weltner-gives-an-inside-look-at-powershell-plus/&quot;&gt;this episode&lt;/a&gt; Tobias Weltner gives an inside look at &lt;a href=&quot;http://www.idera.com/Products/PowerShell/&quot;&gt;PowerShellPlus Professional Edition&lt;/a&gt;. Hal Rottenberg and Jonathan Walz had a bag full of great questions (with a nice contribution from the guys in the ustream.tv chat room) and it seems that Tobias was more than willing to give them in-depth coverage of the PowerShellPlus history and new features in version 2.0.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/6470173626017639101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/6470173626017639101' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6470173626017639101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6470173626017639101'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2008/10/interview-with-tobias-weltner.html' title='An interview with Tobias Weltner'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-6194100159341599789</id><published>2008-08-12T20:44:00.004+02:00</published><updated>2008-08-12T21:21:19.680+02:00</updated><title type='text'>&quot;LDAP query&quot; versus &quot;WHERE&quot;</title><content type='html'>Here is the good example for Jeffrey Snover&#39;s post &lt;a href=&quot;http://blogs.msdn.com/powershell/archive/2008/08/12/when-not-to-use-where.aspx&quot;&gt;&quot;When NOT To Use &quot;WHERE&quot;&quot;&lt;/a&gt;. This is original Andrey Moiseev&#39;s one-liner to get a list of all computed attributes in AD, mentioned in Dmitry Sotnikov&#39;s post &lt;a href=&quot;http://dmitrysotnikov.wordpress.com/2008/08/11/list-all-active-directorycomputed-attributes/&quot;&gt;&quot;List all Constructed Attributes&quot;&lt;/a&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;Get-QADObject -SearchRoot &quot;CN=Schema,CN=Configuration,dc=MyDomain,dc=COM&quot; -Type attributeSchema -IncludedProperties systemFlags -SizeLimit 0 | where {$_.SystemFlags -band 4}&lt;/p&gt;&lt;br /&gt;This one-liner needs &lt;strong&gt;120&lt;/strong&gt; seconds to complete on my system.&lt;br /&gt;&lt;br /&gt;Let&#39;s try the same thing, but this time with LDAP query:&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;Get-QADObject -SearchRoot &quot;CN=Schema,CN=Configuration,dc=MyDomain,dc=COM&quot; -ldapfilter &#39;(systemFlags:1.2.840.113556.1.4.803:=4)&#39; -Type attributeSchema -IncludedProperties systemFlags -SizeLimit 0&lt;/p&gt;&lt;br /&gt;I can see a list of all computed attributes in AD in just &lt;strong&gt;3&lt;/strong&gt; seconds.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/6194100159341599789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/6194100159341599789' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6194100159341599789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/6194100159341599789'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2008/08/ldap-query-versus-where.html' title='&quot;LDAP query&quot; versus &quot;WHERE&quot;'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-927378199128247275</id><published>2008-06-10T23:13:00.003+02:00</published><updated>2008-06-11T21:11:46.370+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>The &quot;#requires&quot; statement</title><content type='html'>Most of us are familiar with #requires -version 2. Jeffrey Snover had written about &lt;a href=&quot;http://blogs.msdn.com/powershell/archive/2007/11/02/ctp-versioning.aspx&quot;&gt;versioning&lt;/a&gt; just before the release of a Community Technology Preview (CTP) of Windows PowerShell v2.0. You start your script with&lt;br /&gt;#requires -version 2&lt;br /&gt;and PowerShell will check version #&#39;s and produce a precise error message.&lt;br /&gt;&lt;br /&gt;The &quot;#requires&quot; statement is not a new feature of PowerShell v2. It&#39;s with us from the PowerShell v1, but no one cared outside the PowerShell team. ;-)&lt;br /&gt;&lt;br /&gt;Do you know that you can check for the presence of the other things too?&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;The &quot;#requires&quot; statement must be in one of the following formats:&lt;br /&gt;&quot;#requires -shellid &amp;lt;shellid&amp;gt;&quot;&lt;br /&gt;&quot;#requires -version &amp;lt;major.minor&amp;gt;&quot;&lt;br /&gt;&quot;#requires -pssnapin &amp;lt;pssnapinname&amp;gt;[-version &amp;lt;major.minor&amp;gt;]&quot;&lt;/p&gt;&lt;br /&gt;For example, you can check if &lt;a href=&quot;http://www.quest.com/activeroles_server/arms.aspx&quot;&gt;quest.activeroles.admanagement&lt;/a&gt; snap-in is added to the current console. Put #requires -pssnapin quest.activeroles.admanagement in your script, and if the snap-in isn&#39;t added, you will get nice error message.&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;The script &#39;test.ps1&#39; cannot be run because the following Windows PowerShell snap-ins that are specified&lt;br /&gt;by its &quot;#requires&quot; statements are missing: quest.activeroles.admanagement.&lt;/p&gt;&lt;br /&gt;By the way, is there any other reserved &quot;comment&quot; statement?</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/927378199128247275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/927378199128247275' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/927378199128247275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/927378199128247275'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2008/06/requires-statement.html' title='The &quot;#requires&quot; statement'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-1768051894417403406</id><published>2008-05-29T14:50:00.005+02:00</published><updated>2008-06-11T21:10:16.530+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="script"/><title type='text'>Search PowerShellCentral Script Repository</title><content type='html'>This is simple function that will help you search &lt;a href=&quot;http://powershellcentral.com/scripts/&quot;&gt;PowerShellCentral Script Repository&lt;/a&gt; right from the command line.&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;function Search-PSCentral {&lt;br /&gt;param([string]$keyword)&lt;br /&gt;(New-Object –com Shell.Application).Open(&quot;http://powershellcentral.com/scripts/?lang=&amp;amp;q=*$keyword*&quot;)&lt;br /&gt;}&lt;/p&gt;&lt;br /&gt;Usage: Search-PSCentral ini&lt;br /&gt;&lt;br /&gt;If you leave out a keyword or there are no results, the page will open ready for you to paste in some code and fill the gap. :-)</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/1768051894417403406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/1768051894417403406' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1768051894417403406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1768051894417403406'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2008/05/search-powershellcentral-script.html' title='Search PowerShellCentral Script Repository'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-1495766905445572490</id><published>2007-11-09T14:51:00.000+01:00</published><updated>2007-11-09T23:21:09.865+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gpo"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>SDM GPMC PowerShell Cmdlets 1.0</title><content type='html'>From now on SDM Software is offering &lt;a href=&quot;http://www.sdmsoftware.com/freeware.php&quot;&gt;SDM GPMC PowerShell Cmdlets 1.0&lt;/a&gt; for free. This version comes with 9 cmdlets for performing GPO management tasks from creating and deleting GPOs, to linking and unlinking them, to modifying GPO security, to backing up and restoring GPOs. After installation you can run them from Start menu or you can add snap-in to your profile file. &lt;p class=&quot;code&quot;&gt;Add-PSSnapin SDMGPOSnapIn&lt;/p&gt; After the snap-in is added, you can use 9 new cmdlets.&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;PS&gt;get-command *sdm* -commandtype cmdlet&lt;br /&gt;Name&lt;br /&gt; ----&lt;br /&gt;Add-SDMgplink&lt;br /&gt;Add-SDMgpoSecurity&lt;br /&gt;Export-SDMgpo&lt;br /&gt;Get-SDMgpo&lt;br /&gt;Get-SDMgpoSecurity&lt;br /&gt;Import-SDMgpo&lt;br /&gt;New-SDMgpo&lt;br /&gt;Remove-SDMgpo&lt;br /&gt;Remove-SDMgpoSecurity&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/1495766905445572490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/1495766905445572490' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1495766905445572490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/1495766905445572490'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2007/11/sdm-gpmc-powershell-cmdlets-10.html' title='SDM GPMC PowerShell Cmdlets 1.0'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-525301304965012926</id><published>2007-07-02T00:39:00.001+02:00</published><updated>2008-06-11T21:11:11.666+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="script"/><title type='text'>Translate with Google Dictionary Translation and PowerShell</title><content type='html'>&lt;a href=&quot;http://www.google.com/translate_t&quot;&gt;Google Translate&lt;/a&gt; has added a nifty new feature: &lt;a href=&quot;http://www.google.com/translate_dict?hl=en&quot;&gt;dictionary translation&lt;/a&gt;. Dictionary translation is currently available between English and French, Italian, German, Spanish, and Korean. You can get it right from the command line with a little help from PowerShell. &lt;br /&gt;&lt;p class=&quot;code&quot;&gt;&lt;br /&gt;&lt;br /&gt;# Usage:&lt;br /&gt;# Get-Translation -word power -dictionary ef&lt;br /&gt;# Get-Translation shell ei&lt;br /&gt;# gt &quot;ab und zu&quot; de&lt;br /&gt;&lt;br /&gt;Function Get-Translation {&lt;br /&gt;param([string]$word=&quot;&quot;,[string]$dictionary=&quot;&quot;)&lt;br /&gt;&lt;br /&gt;switch($dictionary) {&lt;br /&gt;ef {$langpair = &quot;en%7Cfr&quot;} # English-French&lt;br /&gt;fe {$langpair = &quot;fr%7Cen&quot;} # French-English&lt;br /&gt;ed {$langpair = &quot;en%7Cde&quot;} # English-German BETA&lt;br /&gt;de {$langpair = &quot;de%7Cen&quot;} # German-English BETA&lt;br /&gt;ei {$langpair = &quot;en%7Cit&quot;} # English-Italian&lt;br /&gt;ie {$langpair = &quot;it%7Cen&quot;} # Italian-English&lt;br /&gt;ek {$langpair = &quot;en%7Cko&quot;} # English-Korean&lt;br /&gt;ke {$langpair = &quot;ko%7Cen&quot;} # Korean-English&lt;br /&gt;es {$langpair = &quot;en%7Ces&quot;} # English-Spanish&lt;br /&gt;se {$langpair = &quot;es%7Cen&quot;} # Spanish-English&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$objIE = New-Object -Com Internetexplorer.Application&lt;br /&gt;$url = &quot;http://translate.google.com/translate_dict?q=&quot; + $word + &quot;&amp;sa=N&amp;hl=en&amp;langpair=&quot; + $langpair&lt;br /&gt;$objIE.Navigate($url)&lt;br /&gt;$objIE.Visible=$true&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Set-Alias gt Get-Translation&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A dictionary translation of your word or short phrase will be displayed in Internet Explorer.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/525301304965012926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/525301304965012926' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/525301304965012926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/525301304965012926'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2007/07/translate-with-google-dictionary.html' title='Translate with Google Dictionary Translation and PowerShell'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-481543524244148994</id><published>2007-05-21T23:01:00.000+02:00</published><updated>2007-05-21T23:19:32.455+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>How to easy format date/time</title><content type='html'>One of  the easiest ways to format date and time is the command &lt;p class=&quot;code&quot;&gt;get-date -format &amp;lt;string&amp;gt;&lt;/p&gt;&lt;br /&gt;&amp;lt;string&amp;gt; represents the format specifier. For a list of available format specifiers, see the &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx&quot;&gt;System.Globalization.DateTimeFormatInfo Class&lt;/a&gt; topic in MSDN or look at these examples:&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;&lt;br /&gt;PS&gt; get-date -format d&lt;br /&gt;5/21/2007&lt;br /&gt;PS&gt; get-date -format D&lt;br /&gt;Monday, May 21, 2007&lt;br /&gt;PS&gt; get-date -format f&lt;br /&gt;Monday, May 21, 2007 9:24 PM&lt;br /&gt;PS&gt; get-date -format F&lt;br /&gt;Monday, May 21, 2007 9:24:41 PM&lt;br /&gt;PS&gt; get-date -format g&lt;br /&gt;5/21/2007 9:24 PM&lt;br /&gt;PS&gt; get-date -format G&lt;br /&gt;5/21/2007 9:24:50 PM&lt;br /&gt;PS&gt; get-date -format m&lt;br /&gt;May 21&lt;br /&gt;PS&gt; get-date -format M&lt;br /&gt;May 21&lt;br /&gt;PS&gt; get-date -format o&lt;br /&gt;2007-05-21T21:25:03.4218750+02:00&lt;br /&gt;PS&gt; get-date -format r&lt;br /&gt;Mon, 21 May 2007 21:25:09 GMT&lt;br /&gt;PS&gt; get-date -format R&lt;br /&gt;Mon, 21 May 2007 21:25:12 GMT&lt;br /&gt;PS&gt; get-date -format s&lt;br /&gt;2007-05-21T21:25:17&lt;br /&gt;PS&gt; get-date -format t&lt;br /&gt;9:25 PM&lt;br /&gt;PS&gt; get-date -format T&lt;br /&gt;9:25:23 PM&lt;br /&gt;PS&gt; get-date -format u&lt;br /&gt;2007-05-21 21:25:28Z&lt;br /&gt;PS&gt; get-date -format U&lt;br /&gt;Monday, May 21, 2007 7:25:34 PM&lt;br /&gt;PS&gt; get-date -format y&lt;br /&gt;May, 2007&lt;br /&gt;PS&gt; get-date -format Y&lt;br /&gt;May, 2007&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;This blog entry has been inspired by &lt;a href=&quot;http://msgoodies.blogspot.com/2007/05/powershell-best-date-format-for-logs.html&quot;&gt;Per Ostergaard&lt;/a&gt; and &lt;a href=&quot;http://blogs.msdn.com/powershell/archive/2007/05/19/time-stamping-log-files.aspx&quot;&gt;Jeffrey Snover&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/481543524244148994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/481543524244148994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/481543524244148994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/481543524244148994'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2007/05/how-to-easy-format-datetime.html' title='How to easy format date/time'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-5539088099806476365</id><published>2007-03-26T23:12:00.000+02:00</published><updated>2007-03-27T00:11:32.817+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="profile"/><title type='text'>Spring-cleaning of a PowerShell profile</title><content type='html'>After I read James Manning&#39;s post &lt;a href=&quot;http://blogs.msdn.com/jmanning/archive/2007/02/14/why-share-able-functions-shouldn-t-be-in-your-powershell-profile.aspx&quot;&gt;why share-able functions shouldn&#39;t be in your PowerShell profile&lt;/a&gt;, I have looked in my $profile. It was far from small file focused on prompt function, transcript function, one-liners and aliases. So, I created a few subfolders (AD, ISA, Exchange, Misc, Test...) for my scripts in WindowsPowerShell folder. Also, the functions found their place in dedicated folder Functions. The only thing that left is to put all folders with scripts in my path and to dot-source functions from Functions folder.&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;&lt;br /&gt;$profilehome = ([System.IO.FileInfo]$PROFILE).DirectoryName&lt;br /&gt;&lt;br /&gt;dir $profilehome | where {$_.PsIsContainer -and ($_.name -ne &quot;functions&quot;)} | %{$env:path += &quot;;&quot; + $profilehome + &quot;\&quot; + $_.name}&lt;br /&gt;&lt;br /&gt;dir ($profilehome + &quot;\functions&quot;) | where {!$_.PsIsContainer} |&lt;br /&gt; %{. ($profilehome + &quot;\functions\&quot; + $_.name)}&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;$profile is now clean and tidy, and in James Manning&#39;s words - it&#39;s a far more robust, maintainable, shareable, and supportable situation than before.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/5539088099806476365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/5539088099806476365' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/5539088099806476365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/5539088099806476365'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2007/03/spring-cleaning-of-powershell-profile.html' title='Spring-cleaning of a PowerShell profile'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-5848818214523840510</id><published>2007-03-14T20:34:00.000+01:00</published><updated>2007-03-14T23:49:43.356+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>Daily notes with PowerShell</title><content type='html'>The &lt;a href=&quot;http://fundamental.antville.org/stories/1592057/&quot;&gt;post&lt;/a&gt; at Holistic Detection blog gave me an idea how to keep my daily notes organized and just a few keystrokes away.&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;&lt;br /&gt;function New-DailyNotes {&lt;br /&gt; &lt;br /&gt; # store files in subfolder &lt;em&gt;notes&lt;/em&gt; in &lt;em&gt;WindowsPowerShell&lt;/em&gt; folder&lt;br /&gt; $path = (join-path ([System.IO.FileInfo]$profile).DirectoryName \notes\)&lt;br /&gt; # files will be named like &lt;em&gt;2007-03-14_notes.txt&lt;/em&gt;&lt;br /&gt; $notesfile = (get-date).ToString(&quot;yyyy-MM-dd&quot;) + &quot;_notes.txt&quot;&lt;br /&gt;&lt;br /&gt; if( !(test-path $path ) ) &lt;br /&gt; {&lt;br /&gt;   # create the notes directory if it doesn&#39;t exist&lt;br /&gt;   new-item -path $path -type directory&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;   $notespath = (join-path $path $notesfile)&lt;br /&gt;   if( !(test-path $notespath ) ) &lt;br /&gt;   {&lt;br /&gt;     # create the notes file if it doesn&#39;t exist&lt;br /&gt;     new-item -path $path -name $notesfile -type &quot;file&quot;&lt;br /&gt;     notepad $notespath&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;     notepad $notespath&lt;br /&gt;   }&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;set-alias dn New-DailyNotes&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;I&#39;ve added this function to the profile file and I only have to type &lt;em&gt;dn&lt;/em&gt; to get access to my daily notes file.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/5848818214523840510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/5848818214523840510' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/5848818214523840510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/5848818214523840510'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2007/03/daily-notes-with-powershell.html' title='Daily notes with PowerShell'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-5412790128913769175</id><published>2006-11-12T21:03:00.000+01:00</published><updated>2007-03-14T23:49:43.357+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="basics"/><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>Osnove - Uvod u objektni model</title><content type='html'>Ključna stvar u čemu se Windows PowerShell razlikuje od sličnih shell okruženja jeste osobina da radi isključivo sa objektima. Rezultat komande koju kucate u shell-u na Linux-u je tekst. Na primer&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;unixcode&quot;&gt;#ps -e&lt;br /&gt;PID TTY TIME CMD&lt;br /&gt;1 ? 00:08:00 init&lt;br /&gt;12021 ? 00:00:00 kdm &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Ukoliko sada želimo da prekinemo proces &lt;em&gt;kdm&lt;/em&gt; moramo da izdvojimo deo teksta koji se odnosi na broj procesa (PID kolona) i da ga prosledimo kao parametar komandi za prekid procesa (&lt;em&gt;kill&lt;/em&gt;).&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;unixcode&quot;&gt;# ps -e | grep &quot;  kdm&quot; | awk &#39;{ print $1 }&#39; | xargs kill &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Problem ovog pristupa je da veci deo vremena provodimo formatirajući tekst, što može da bude složeno i zamorno, ali se zato sve komanda se izvršavaju gotovo trenutno.&lt;br /&gt;&lt;br /&gt;Windows PowerShall sa druge strane radi sa objektima. Pogledajmo šta se dešava ako otkucamo komandu &lt;em&gt;dir&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;PS&gt; dir&lt;br /&gt;&lt;br /&gt;Directory: Microsoft.PowerShell.Core\FileSystem::C:\&lt;br /&gt;&lt;br /&gt;Mode LastWriteTime Length Name&lt;br /&gt;---- ------------- ------ ----&lt;br /&gt;d---- 9/23/2006 2:23 PM ATI&lt;br /&gt;d---- 9/21/2006 10:41 PM Documents and Settings&lt;br /&gt;...&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Iako reuzultat izgleda kao par redova teksta, u stari u pitanju je niz objekata koji su tipa &lt;span style=&quot;FONT-STYLE: italic&quot;&gt;System.IO.FileInfo&lt;/span&gt;. Ukoliko vas ovo podseća na .NET, u pravu ste, osnova Windows PowerShell-a jeste .NET.&lt;br /&gt;&lt;br /&gt;Komande su u stvari funkcije čiji su ulazi i izlazi objekti. Ako se vratimo našem primeru koji prekida proces &lt;em&gt;kdm&lt;/em&gt;, ekvivalentan primer bi u PS bi bio:&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;code&quot;&gt;PS&gt; get-process kdm | stop-process &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Vidi se da je zapis mnogo čitljiviji, jedina mana je što se malo gubino na brzini. Meni se iskreno ovo mnogo više sviđa, jer se kod lakše i brže piše.&lt;br /&gt;&lt;br /&gt;Ovo se može mnogo bolje videti na malo složenijem primeru, sledeće komande prekidaju sve procese koji troše više od 10MB memorije.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;bash&lt;br /&gt;&lt;/strong&gt;&lt;p class=&quot;unixcode&quot;&gt;# ps -el | awk &#39;{ if ( $6 &gt; (1024*10)) { print $3 } }&#39; | grep -v PID | xargs kill &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Windows PowerShell&lt;br /&gt;&lt;/strong&gt;&lt;p class=&quot;code&quot;&gt;PS&gt; get-process | where { $_.VS -gt 10M } | stop-process &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Čak i ako nikada niste videli PowerShell, velika je verovatnoća da će te samo na osnovu koda razumeti o čemu se radi. Što se bash-a tiče tu ne bih bio tako siguran.&lt;br /&gt;&lt;br /&gt;Ovo je tek početak, u sledećem tekstu videćemo da su i promenljive objekti. Takođe videćemo kako lako možemo da saznamo koji svi &lt;em&gt;properties&lt;/em&gt; i &lt;em&gt;methods&lt;/em&gt; postoje za neki objekat.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/5412790128913769175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/5412790128913769175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/5412790128913769175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/5412790128913769175'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2006/11/osnove-uvod-u-objektni-model.html' title='Osnove - Uvod u objektni model'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-4592762736563481609</id><published>2006-10-20T12:37:00.001+02:00</published><updated>2007-03-14T23:49:43.357+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>Code Test 2</title><content type='html'>&lt;p class=&quot;code&quot;&gt;1: $a = ipconfig /all | findstr &quot;172.16.1.&quot; | %{$_.remove(0,44)}&lt;br /&gt;2: route add 192.168.0.0 mask 255.255.0.0 $a&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/4592762736563481609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/4592762736563481609' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4592762736563481609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4592762736563481609'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2006/10/code-test-2.html' title='Code Test 2'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36207740.post-4204449068333494027</id><published>2006-10-19T15:56:00.001+02:00</published><updated>2007-03-14T23:49:43.358+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="download"/><category scheme="http://www.blogger.com/atom/ns#" term="info"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>Da li ste već čuli za Windows PowerShell?</title><content type='html'>&lt;a href=&quot;http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx&quot;&gt;Windows PowerShell&lt;/a&gt;. Najvrelija stvar koja ovih dana stiže iz Redmonda. Šta je Windows PowerShell? Da se ne bih pravio pametniji od samih tvoraca, pravo je vreme da ubacim mali citat, direktno sa MS sajta - &quot;&lt;span style=&quot;font-style: italic;&quot;&gt;Microsoft Windows PowerShell command line shell and scripting language helps IT Professionals achieve greater productivity. Using a new admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT Professionals to more easily control system administration and accelerate automation.&lt;/span&gt;&quot; Ključne reči su: &lt;span style=&quot;font-style: italic; color: rgb(0, 0, 0);&quot;&gt;command line shell&lt;/span&gt;, &lt;span style=&quot;font-style: italic; color: rgb(0, 0, 0);&quot;&gt;scripting language&lt;/span&gt; i &lt;span style=&quot;font-style: italic; color: rgb(0, 0, 0);&quot;&gt;admin-focused&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Kao da se svakog dana pojavljuju novi blogovi koji se njime bave (a još se nije ni pojavila finalna verzija). Jedna od udarnih tema na Tech·Ed 2007 u Barseloni biće upravo PowerShell. Informacija ima toliko da čovek ne zna šta pre da pročita, koji skript pre da proba. Odabrane izvore informacija naći ćete u okviru sidebar-a. U vrlo skoroj budućnosti nećete moći administirati Windows sisteme bez znanja PowerShell-a. Ne čekajte finalnu verziju. Preuzmite trenutno aktuelan &lt;a href=&quot;http://www.microsoft.com/downloads/results.aspx?pocId=&amp;freetext=powershell&amp;amp;amp;amp;amp;DisplayLang=en&quot;&gt;Windows Powershell 1.0 RC2&lt;/a&gt; (potreban vam je i &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&amp;amp;displaylang=en&quot;&gt;.NET Framework 2.0&lt;/a&gt;, ako ga već nemate instaliran) i zaronite u najbolji shell na svetu. The shell must flow.</content><link rel='replies' type='application/atom+xml' href='http://powershellers.blogspot.com/feeds/4204449068333494027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36207740/4204449068333494027' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4204449068333494027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36207740/posts/default/4204449068333494027'/><link rel='alternate' type='text/html' href='http://powershellers.blogspot.com/2006/10/da-li-ste-ve-uli-za-windows-powershell.html' title='Da li ste već čuli za Windows PowerShell?'/><author><name>aleksandar</name><uri>http://www.blogger.com/profile/11946050716712696119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>