<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>get-life | add-powershell</title><link>http://powershell.com/cs/blogs/aleksandar/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/add-powershell" /><feedburner:info uri="add-powershell" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>PowerShell Dinner at TechEd Europe 2009</title><link>http://feedproxy.google.com/~r/add-powershell/~3/lzjiNIDMeyg/powershell-dinner-at-teched-europe-2009.aspx</link><pubDate>Fri, 27 Nov 2009 08:16:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:3963</guid><dc:creator>Aleksandar</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://powershell.com/cs/blogs/aleksandar/rsscomments.aspx?PostID=3963</wfw:commentRss><wfw:comment>http://powershell.com/cs/blogs/aleksandar/commentapi.aspx?PostID=3963</wfw:comment><comments>http://powershell.com/cs/blogs/aleksandar/archive/2009/11/27/powershell-dinner-at-teched-europe-2009.aspx#comments</comments><description>&lt;p&gt;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;/p&gt;
&lt;table style="width:auto;"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="http://picasaweb.google.com/lh/photo/sHULoGrO66zmVmjzFAxd3Q?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_vV5tHEFKm74/SwmP-wqZlbI/AAAAAAAAAHU/6s1eui8k0zE/s288/IMG_5452.JPG" alt="" /&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="font-family:arial,sans-serif;font-size:11px;text-align:right;"&gt;From &lt;a href="http://picasaweb.google.com/alexandair/PowerShellDinnerAtTechEdEurope2009?feat=embedwebsite"&gt;PowerShell Dinner at TechEd Europe 2009&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
It was a great privilege to talk about PowerShell with fellow PowerShell addicts. And, let&amp;#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="http://picasaweb.google.com/alexandair/PowerShellDinnerAtTechEdEurope2009"&gt;PowerShell Dinner at TechEd Europe 2009&lt;/a&gt; album.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=3963" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/add-powershell/~4/lzjiNIDMeyg" height="1" width="1"/&gt;</description><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/tobias/default.aspx">tobias</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powershell/default.aspx">powershell</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/conference/default.aspx">conference</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/TEE09/default.aspx">TEE09</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/TechEd/default.aspx">TechEd</category><feedburner:origLink>http://powershell.com/cs/blogs/aleksandar/archive/2009/11/27/powershell-dinner-at-teched-europe-2009.aspx</feedburner:origLink></item><item><title>PowerShell V2: Meet New-Object's Property parameter</title><link>http://feedproxy.google.com/~r/add-powershell/~3/xkstThholuI/powershell-v2-meet-new-object-s-property-parameter.aspx</link><pubDate>Sun, 18 Oct 2009 01:50:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:3614</guid><dc:creator>Aleksandar</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://powershell.com/cs/blogs/aleksandar/rsscomments.aspx?PostID=3614</wfw:commentRss><wfw:comment>http://powershell.com/cs/blogs/aleksandar/commentapi.aspx?PostID=3614</wfw:comment><comments>http://powershell.com/cs/blogs/aleksandar/archive/2009/10/18/powershell-v2-meet-new-object-s-property-parameter.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve stumbled upon &lt;a href="http://www.resourcefuladmin.com/2009/09/remote-windows2003-registry-and-powershell/"&gt;blog post&lt;/a&gt; that talks about accessing remote registry, collecting &amp;quot;Automatic Update&amp;quot; configuration info and creating custom object to hold that data for further processing/formatting.&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&amp;#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;p&gt;Let&amp;#39;s rewrite a function. &lt;/p&gt;
&lt;pre&gt;function Get-WSUSRegKey {
   [CmdletBinding()]
   param (
      [parameter(ValueFromPipeline=$true)]
      [String[]]$ComputerName = $env:computername
   )

   PROCESS {
      $ComputerName | ForEach-Object {
      # open remote registry key
      $rootKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(&amp;#39;LocalMachine&amp;#39;,$_)
      # open subkey WindowsUpdate and its subkey AU
      $regKey0 = $rootKey.OpenSubKey(&amp;quot;Software\policies\Microsoft\Windows\WindowsUpdate\&amp;quot;)
      $regKey1 = $rootKey.OpenSubKey(&amp;quot;Software\policies\Microsoft\Windows\WindowsUpdate\&amp;quot; + $($regKey0.GetSubKeyNames()))

      # create an empty hash table
      $ht = @{}
      # enumerate value names in both subkeys and populate hash table with name/value pairs 
      $regKey0.GetValueNames() | ForEach-Object {$ht.$_ = $regKey0.GetValue($_)}
      $regKey1.GetValueNames() | ForEach-Object {$ht.$_ = $regKey1.GetValue($_)}
      # this will add ComputerName NoteProperty to our object
      $ht.ComputerName = $_
      # and finally, create an object using the data stored in a hash table
      New-Object PSObject -Property $ht
      }
   }
}&lt;/pre&gt;
&lt;p&gt;Two usage examples: &lt;/p&gt;
&lt;pre class="code"&gt;PS C:\&amp;gt; $servers = &amp;#39;server1&amp;#39;,&amp;#39;server2&amp;#39;,&amp;#39;server3&amp;#39;
PS C:\&amp;gt; Get-WSUSRegKey -ComputerName $servers
PS C:\&amp;gt; $servers | Get-WSUSRegKey | Format-Table ComputerName,WUServer
&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=3614" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/add-powershell/~4/xkstThholuI" height="1" width="1"/&gt;</description><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/code/default.aspx">code</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powershell/default.aspx">powershell</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/v2/default.aspx">v2</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powershell+v2/default.aspx">powershell v2</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/registry/default.aspx">registry</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/WSUS/default.aspx">WSUS</category><feedburner:origLink>http://powershell.com/cs/blogs/aleksandar/archive/2009/10/18/powershell-v2-meet-new-object-s-property-parameter.aspx</feedburner:origLink></item><item><title>What happened to a CustomMenu property?</title><link>http://feedproxy.google.com/~r/add-powershell/~3/to82lWwCkNU/what-happened-to-a-custommenu-property.aspx</link><pubDate>Sun, 03 May 2009 22:02:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:2420</guid><dc:creator>Aleksandar</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://powershell.com/cs/blogs/aleksandar/rsscomments.aspx?PostID=2420</wfw:commentRss><wfw:comment>http://powershell.com/cs/blogs/aleksandar/commentapi.aspx?PostID=2420</wfw:comment><comments>http://powershell.com/cs/blogs/aleksandar/archive/2009/05/04/what-happened-to-a-custommenu-property.aspx#comments</comments><description>&lt;p&gt;If you&amp;#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;/p&gt;
&lt;pre class="code"&gt;PS C:\&amp;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;p&gt;
Same command in Windows PowerShell ISE RC will give renamed type and properties:
  &lt;/p&gt;
&lt;pre class="code"&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;p&gt;
Runspace is PowerShell Tab now, and &lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;span style="font-style:italic;"&gt;Opened&lt;/span&gt; was unnecessary, but what happened to a CustomMenu property?
Let&amp;#39;s see what CurrentPowerShellTab can offer:
&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre class="code"&gt;PS C:\&amp;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;p&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;/p&gt;
&lt;pre&gt;$psISE.CustomMenu.Submenus.Add(&amp;quot;Run single line&amp;quot;, {Invoke-CaretLine} , &amp;#39;F7&amp;#39;)&lt;/pre&gt;
&lt;p&gt;
So, what we are looking for is a Submenus property. Let&amp;#39;s hope that an AddOnsMenu has one. :)

&lt;/p&gt;
&lt;pre class="code"&gt;PS C:\&amp;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;p&gt;
Bingo!
&lt;/p&gt;
&lt;pre class="code"&gt;PS C:\&amp;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;p&gt;
What the fluff?! Where is an Add method?&lt;/p&gt;
&lt;p&gt;As we have learnt in V1, when you miss some member use a psbase property:
&lt;/p&gt;
&lt;pre class="code"&gt;PS C:\&amp;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;p&gt;
That&amp;#39;s much better. :)&lt;/p&gt;
&lt;p&gt;Now it&amp;#39;s easy to add our first customized menu item:
&lt;/p&gt;
&lt;pre class="code"&gt;$action = {$p = Read-Host &amp;quot;Enter parameter name&amp;quot;;Get-Help * -parameter $p}&lt;br /&gt;$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(&amp;quot;Find parameter&amp;quot;,$action,&amp;#39;Ctrl+Shift+F3&amp;#39;)&lt;/pre&gt;
&lt;p&gt;
If we want to create a submenu, we need to omit an action:
&lt;/p&gt;
&lt;pre class="code"&gt;$m = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(&amp;quot;Execution Policy&amp;quot;,$null,$null)&lt;/pre&gt;
&lt;p&gt;
And then we can add the menu items:
&lt;/p&gt;
&lt;pre class="code"&gt;$m.Submenus.Add(&amp;quot;Get policy&amp;quot;,{Get-ExecutionPolicy},&amp;#39;CTRL+Shift+J&amp;#39;)}&lt;br /&gt;$m.Submenus.Add(&amp;quot;Set policy&amp;quot;,{Set-ExecutionPolicy RemoteSigned},&amp;#39;CTRL+Shift+K&amp;#39;)}&lt;/pre&gt;
&lt;p&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;/p&gt;
&lt;p&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;/p&gt;
&lt;p&gt;While we talk about changes in a new Windows PowerShell ISE, let&amp;#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="font-style:italic;"&gt;New Remote PowerShell Tab...&lt;/span&gt; which will start an interactive session with a remote computer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=2420" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/add-powershell/~4/to82lWwCkNU" height="1" width="1"/&gt;</description><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/code/default.aspx">code</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powershell/default.aspx">powershell</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/v2/default.aspx">v2</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powershell+ise/default.aspx">powershell ise</category><feedburner:origLink>http://powershell.com/cs/blogs/aleksandar/archive/2009/05/04/what-happened-to-a-custommenu-property.aspx</feedburner:origLink></item><item><title>Get-Alias ?</title><link>http://feedproxy.google.com/~r/add-powershell/~3/Vr664gbuZNo/get-alias.aspx</link><pubDate>Tue, 17 Feb 2009 12:28:30 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:1483</guid><dc:creator>Aleksandar</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://powershell.com/cs/blogs/aleksandar/rsscomments.aspx?PostID=1483</wfw:commentRss><wfw:comment>http://powershell.com/cs/blogs/aleksandar/commentapi.aspx?PostID=1483</wfw:comment><comments>http://powershell.com/cs/blogs/aleksandar/archive/2009/02/17/get-alias.aspx#comments</comments><description>&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&amp;#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="code"&gt; &lt;p&gt;PS&amp;gt;get-alias ? &lt;/p&gt; &lt;p&gt;CommandType Name Definition &lt;br /&gt;----------- -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---------- &lt;br /&gt;Alias&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForEach-Object &lt;br /&gt;Alias&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where-Object &lt;br /&gt;Alias&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-History &lt;br /&gt;Alias&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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&gt; &lt;p class="code"&gt; &lt;p&gt;PS&amp;gt;get-alias &amp;#39;`?&amp;#39;&lt;/p&gt; &lt;p&gt;CommandType Name Definition &lt;br /&gt;-----------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----&amp;nbsp;&amp;nbsp;&amp;nbsp; ---------- &lt;br /&gt;Alias&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where-Object&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;Double quotes don&amp;#39;t work in both V1 and V2 CTP3. Does somebody know why? &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=1483" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/add-powershell/~4/Vr664gbuZNo" height="1" width="1"/&gt;</description><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/CTP3/default.aspx">CTP3</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/code/default.aspx">code</category><feedburner:origLink>http://powershell.com/cs/blogs/aleksandar/archive/2009/02/17/get-alias.aspx</feedburner:origLink></item><item><title>Do you know the aliases for the New-Item cmdlet?</title><link>http://feedproxy.google.com/~r/add-powershell/~3/eSBrjH3-l7I/do-you-know-the-aliases-for-the-new-item-cmdlet.aspx</link><pubDate>Fri, 06 Feb 2009 01:14:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:1389</guid><dc:creator>Aleksandar</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://powershell.com/cs/blogs/aleksandar/rsscomments.aspx?PostID=1389</wfw:commentRss><wfw:comment>http://powershell.com/cs/blogs/aleksandar/commentapi.aspx?PostID=1389</wfw:comment><comments>http://powershell.com/cs/blogs/aleksandar/archive/2009/02/06/do-you-know-the-aliases-for-the-new-item-cmdlet.aspx#comments</comments><description>&lt;p&gt;I was playing with Doug Finke&amp;#39;s extensions for PowerShell ISE (Integrated Scripting Environment), &lt;a href="http://dougfinke.com/blog/index.php/2009/02/03/powershell-ise-cream/"&gt;Expand-Alias and Expand-CurrentAlias&lt;/a&gt;, when I&amp;#39;ve noticed that &lt;i&gt;mkdir&lt;/i&gt; doesn&amp;#39;t expand and &lt;i&gt;md&lt;/i&gt; expands to &lt;i&gt;mkdir&lt;/i&gt;. Up until now I thought that &lt;i&gt;mkdir&lt;/i&gt; and &lt;i&gt;md&lt;/i&gt; are aliases for the &lt;i&gt;New-Item&lt;/i&gt; cmdlet as &lt;i&gt;rmdir&lt;/i&gt; and &lt;i&gt;rd&lt;/i&gt; are the aliases for the &lt;i&gt;Remove-Item&lt;/i&gt; cmdlet. &lt;br /&gt;&lt;br /&gt;In both PowerShell V1 and V2 CTP3: &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;PS&amp;gt; get-alias | ? {$_.definition -eq &amp;#39;remove-item&amp;#39;} &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;CommandType Name&amp;nbsp; Definition &lt;br /&gt;------------------&amp;nbsp; -------&amp;nbsp; -----------&lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ri &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Remove-Item &lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rm &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Remove-Item &lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rmdir &amp;nbsp; Remove-Item &lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del &amp;nbsp; &amp;nbsp;&amp;nbsp; Remove-Item &lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; erase&amp;nbsp; Remove-Item &lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rd &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; Remove-Item&lt;/p&gt;
&lt;p class="code"&gt;&lt;br /&gt;&lt;br /&gt;PS&amp;gt; get-alias | ? {$_.definition -eq &amp;#39;new-item&amp;#39;} &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;CommandType Name Definition &lt;br /&gt;------------------&amp;nbsp; ------&amp;nbsp; ---------- &lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ni &amp;nbsp; &amp;nbsp; &amp;nbsp; New-Item&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;b&gt;Where are the mkdir and md?&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;The &lt;i&gt;mkdir&lt;/i&gt; and &lt;i&gt;md&lt;/i&gt; are built-in functions in PowerShell V1 with the same definition: &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;PS&amp;gt; gci function: | ? {$_.name -like &amp;#39;m*d*&amp;#39;} | ft -auto &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;CommandType Name&amp;nbsp; Definition &lt;br /&gt;------------------&amp;nbsp; -------&amp;nbsp; ---------- &lt;br /&gt;Function &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; mkdir &amp;nbsp; param([string[]]$paths); New-Item -type directory -path $paths &lt;br /&gt;Function &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; md &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; param([string[]]$paths); New-Item -type directory -path $paths&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;The things are different in PowerShell V2 CTP3. The &lt;i&gt;mkdir&lt;/i&gt; command is still a function, but with much more complex definition, and &lt;i&gt;md&lt;/i&gt; is an alias for &lt;i&gt;mkdir&lt;/i&gt;. &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;PS&amp;gt; gci function: | ? {$_.name -like &amp;#39;m*d*&amp;#39;} &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;CommandType Name&amp;nbsp; Definition &lt;br /&gt;------------------&amp;nbsp; -------&amp;nbsp; ---------- &lt;br /&gt;Function &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; mkdir&amp;nbsp;&amp;nbsp; ... &lt;br /&gt;&lt;br /&gt;PS&amp;gt; get-alias md &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;CommandType Name Definition &lt;br /&gt;------------------&amp;nbsp; ------- ----------- &lt;br /&gt;Alias &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; md &amp;nbsp;&amp;nbsp; &amp;nbsp; mkdir&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;To see the code behind &lt;i&gt;mkdir&lt;/i&gt; command type: &lt;br /&gt;&lt;/p&gt;
&lt;p class="code"&gt;PS&amp;gt; gc function:\mkdir&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;Very nice example of an advanced function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=1389" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/add-powershell/~4/eSBrjH3-l7I" height="1" width="1"/&gt;</description><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/CTP3/default.aspx">CTP3</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/code/default.aspx">code</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powershell/default.aspx">powershell</category><feedburner:origLink>http://powershell.com/cs/blogs/aleksandar/archive/2009/02/06/do-you-know-the-aliases-for-the-new-item-cmdlet.aspx</feedburner:origLink></item><item><title>-include and -exclude go together</title><link>http://feedproxy.google.com/~r/add-powershell/~3/Txu4K_baoJY/include-and-exclude-go-together.aspx</link><pubDate>Sun, 09 Nov 2008 22:23:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:190</guid><dc:creator>Aleksandar</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://powershell.com/cs/blogs/aleksandar/rsscomments.aspx?PostID=190</wfw:commentRss><wfw:comment>http://powershell.com/cs/blogs/aleksandar/commentapi.aspx?PostID=190</wfw:comment><comments>http://powershell.com/cs/blogs/aleksandar/archive/2008/11/09/include-and-exclude-go-together.aspx#comments</comments><description>&lt;p&gt;While reading James Brundage&amp;#39;s blog post &lt;a href="http://blogs.msdn.com/mediaandmicrocode/archive/2008/11/08/microcode-exploring-more-of-net-with-get-assembly.aspx"&gt;Microcode: Exploring More of .NET with Get-Assembly&lt;/a&gt;, I have spotted a rather unnecessary complicated part of a code:&lt;/p&gt;
&lt;div class="listing"&gt;
&lt;pre&gt;&lt;span class="verbnoun"&gt;Get-ChildItem&lt;/span&gt; (&lt;span class="verbnoun"&gt;Join-Path&lt;/span&gt; &lt;span class="var"&gt;$env:Windir&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;Assembly&amp;quot;&lt;/span&gt;) &lt;span class="modifier"&gt;-recurse&lt;/span&gt; &lt;span class="op"&gt;-&lt;/span&gt;&lt;span class="keyword"&gt;filter&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;*.dll&amp;quot;&lt;/span&gt; |&lt;br /&gt;        &lt;span class="verbnoun"&gt;Where-Object&lt;/span&gt; {&lt;br /&gt;            &lt;span class="op"&gt;!&lt;/span&gt; &lt;span class="var"&gt;$_&lt;/span&gt;.&lt;span class="namespace"&gt;Name.Substring&lt;/span&gt;(0,&lt;span class="var"&gt;$_&lt;/span&gt;.&lt;span class="namespace"&gt;Name.IndexOf&lt;/span&gt;(&lt;span class="var"&gt;$_&lt;/span&gt;.&lt;span class="method"&gt;Extension&lt;/span&gt;)).&lt;span class="method"&gt;EndsWith&lt;/span&gt;(&lt;span class="string"&gt;&amp;quot;.ni&amp;quot;&lt;/span&gt;)&lt;br /&gt;        }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&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;/p&gt;
&lt;div class="listing"&gt;
&lt;pre&gt;&lt;span class="verbnoun"&gt;Get-ChildItem&lt;/span&gt; (&lt;span class="verbnoun"&gt;Join-Path&lt;/span&gt; &lt;span class="var"&gt;$env:Windir&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;Assembly&amp;quot;&lt;/span&gt;) &lt;span class="modifier"&gt;-recurse&lt;/span&gt; &lt;span class="op"&gt;-&lt;/span&gt;&lt;span class="keyword"&gt;filter&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;*.dll&amp;quot;&lt;/span&gt; |&lt;br /&gt; &lt;span class="verbnoun"&gt;Where-Object&lt;/span&gt; {&lt;span class="var"&gt;$_&lt;/span&gt;.&lt;span class="method"&gt;name&lt;/span&gt; &lt;span class="op"&gt;-notlike&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;*.ni.*&amp;quot;&lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;It&amp;#39;ll do the job and it&amp;#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="http://huddledmasses.org/"&gt;Joel &amp;#39;Jaykul&amp;#39; Bennett&lt;/a&gt;). So, the final command is:&lt;br /&gt;&lt;span class="verbnoun"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="verbnoun"&gt;Get-ChildItem&lt;/span&gt; (&lt;span class="verbnoun"&gt;Join-Path&lt;/span&gt; &lt;span class="var"&gt;$env:Windir&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;Assembly&amp;quot;&lt;/span&gt;) &lt;span class="modifier"&gt;-recurse&lt;/span&gt; &lt;span class="modifier"&gt;-include&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;*.dll&amp;quot;&lt;/span&gt; &lt;span class="modifier"&gt;-exclude&lt;/span&gt; &lt;span class="string"&gt;&amp;quot;*.ni.*&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Isn&amp;#39;t that easier to write (and probably faster to execute)?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=190" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/add-powershell/~4/Txu4K_baoJY" height="1" width="1"/&gt;</description><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/assembly/default.aspx">assembly</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/Get-Childitem/default.aspx">Get-Childitem</category><feedburner:origLink>http://powershell.com/cs/blogs/aleksandar/archive/2008/11/09/include-and-exclude-go-together.aspx</feedburner:origLink></item><item><title>An interview with Tobias Weltner</title><link>http://feedproxy.google.com/~r/add-powershell/~3/FJ-q5Q_atps/an-interview-with-tobias-weltner.aspx</link><pubDate>Mon, 06 Oct 2008 04:49:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:46</guid><dc:creator>Aleksandar</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://powershell.com/cs/blogs/aleksandar/rsscomments.aspx?PostID=46</wfw:commentRss><wfw:comment>http://powershell.com/cs/blogs/aleksandar/commentapi.aspx?PostID=46</wfw:comment><comments>http://powershell.com/cs/blogs/aleksandar/archive/2008/10/06/an-interview-with-tobias-weltner.aspx#comments</comments><description>&lt;p&gt;For those of you who have missed it when it was &lt;a href="http://www.ustream.tv/channel/powerscripting-podcast"&gt;broadcasted live&lt;/a&gt;, new episode of famous&amp;nbsp;&lt;a href="http://powerscripting.wordpress.com/"&gt;PowerScripting Podcast&lt;/a&gt; is online and ready for listening. In &lt;a href="http://powerscripting.wordpress.com/2008/10/05/episode-44-tobias-weltner-gives-an-inside-look-at-powershell-plus/"&gt;this episode&lt;/a&gt; Tobias Weltner gives an inside look at &lt;a href="http://www.idera.com/Products/PowerShell/"&gt;PowerShellPlus Professional Edition&lt;/a&gt;.&amp;nbsp;&lt;em&gt;&lt;span style="font-style:normal;"&gt;Hal Rottenberg&lt;/span&gt;&lt;/em&gt;&amp;nbsp;and&amp;nbsp;&lt;em&gt;&lt;span style="font-style:normal;"&gt;Jonathan Walz&amp;nbsp;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.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://powershell.com/cs/aggbug.aspx?PostID=46" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/add-powershell/~4/FJ-q5Q_atps" height="1" width="1"/&gt;</description><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/interview/default.aspx">interview</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/podcast/default.aspx">podcast</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powershellplus/default.aspx">powershellplus</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/tobias/default.aspx">tobias</category><category domain="http://powershell.com/cs/blogs/aleksandar/archive/tags/powerscripting+podcast/default.aspx">powerscripting podcast</category><feedburner:origLink>http://powershell.com/cs/blogs/aleksandar/archive/2008/10/06/an-interview-with-tobias-weltner.aspx</feedburner:origLink></item></channel></rss>
