<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>PowerShell Magazine - Latest Comments</title><link xmlns="http://www.w3.org/2005/Atom" rel="http://api.friendfeed.com/2008/03#sup" href="http://disqus.com/sup/all.sup#forumcomments-1c702bba" type="application/json"/><link>http://powershellmagazine.disqus.com/</link><description></description><atom:link href="http://powershellmagazine.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 21 May 2013 15:15:56 -0000</lastBuildDate><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-904172506</link><description>&lt;p&gt;Great idea using the compound assignment operator.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">DVS</dc:creator><pubDate>Tue, 21 May 2013 15:15:56 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903799558</link><description>&lt;p&gt;My solution would be to bypass using [Math]::Pow in order to make it shorter. So I would go for this:&lt;/p&gt;

&lt;p&gt;$s = 1234567890123456&lt;/p&gt;

&lt;p&gt;1..5|%{[Math]::Floor(($s/=1024))}&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jaap Brasser</dc:creator><pubDate>Tue, 21 May 2013 07:57:55 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903668597</link><description>&lt;p&gt;1..5|%{[math]::truncate(123456789/[math]::pow(1024,$_))}&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Vladimír Meier</dc:creator><pubDate>Tue, 21 May 2013 02:35:39 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903621742</link><description>&lt;p&gt;PS C:\&amp;gt; $size = 12345678901234568989&lt;/p&gt;

&lt;p&gt;PS C:\&amp;gt; 1..5 | % { [math]::Round(($size/[Math]::Pow(1024,$_)),0)}&lt;/p&gt;

&lt;p&gt;12056327051986884&lt;/p&gt;

&lt;p&gt;11773756886706&lt;/p&gt;

&lt;p&gt;11497809460&lt;/p&gt;

&lt;p&gt;11228330&lt;/p&gt;

&lt;p&gt;10965&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Vinith Menon</dc:creator><pubDate>Tue, 21 May 2013 00:33:48 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903611424</link><description>&lt;p&gt;Anything except PowerShell multipliers is absolutely allowed. All you need is the shortest answer!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ravikanth</dc:creator><pubDate>Tue, 21 May 2013 00:11:06 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903542236</link><description>&lt;p&gt;$size = 1234567890123456&lt;br&gt;1..5|%{"{0:N0}"-f($size/[math]::pow(1024,$_))}&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">DVS</dc:creator><pubDate>Mon, 20 May 2013 22:09:09 -0000</pubDate></item><item><title>Re: PowerShell Summit 2013: Build Your Demo Environment or a Test Lab with Windows PowerShell</title><link>http://www.powershellmagazine.com/2013/04/30/powershell-summit-2013-build-your-demo-environment-or-a-test-lab-with-windows-powershell/#comment-903386346</link><description>&lt;p&gt;Yes, there is only one slide. That's why I've added a smiley. :)&lt;br&gt;I hope you'll enjoy the demo code.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Aleksandar Nikolić</dc:creator><pubDate>Mon, 20 May 2013 18:02:13 -0000</pubDate></item><item><title>Re: PowerShell Summit 2013: Build Your Demo Environment or a Test Lab with Windows PowerShell</title><link>http://www.powershellmagazine.com/2013/04/30/powershell-summit-2013-build-your-demo-environment-or-a-test-lab-with-windows-powershell/#comment-903372937</link><description>&lt;p&gt;Is it just me, or is the slide deck just one slide?&lt;br&gt;Anyway, I'm getting a lot of benefit from looking thru the PowerShell script.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cincinnerdi</dc:creator><pubDate>Mon, 20 May 2013 17:44:09 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903351012</link><description>&lt;p&gt;I added a few digits to $size, otherwise I get 0 for everything beyond GB:&lt;/p&gt;

&lt;p&gt;$size = 1234567890123456&lt;br&gt;1..5 | % { [Math]::Floor($size/[Math]::Pow(1024, $_))}&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kevin Doblosky</dc:creator><pubDate>Mon, 20 May 2013 17:18:02 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903297884</link><description>&lt;p&gt;Maybe I am missing something, but wouldn't this do the trick?  Or is using .NET not allowed?&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6$size = 123456789&lt;/p&gt;

&lt;p&gt;[int]($size / [math]::pow(1024,1))&lt;br&gt;[int]($size / [math]::pow(1024,2))&lt;/p&gt;

&lt;p&gt;[int]($size / [math]::pow(1024,3))&lt;/p&gt;

&lt;p&gt;[int]($size / [math]::pow(1024,4))&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Birley</dc:creator><pubDate>Mon, 20 May 2013 16:15:56 -0000</pubDate></item><item><title>Re: Converting to size units (KB, MB,GB,TB, and PB) without using PowerShell multipliers</title><link>http://www.powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers/#comment-903286351</link><description>&lt;p&gt;$i=1;1..5|%{[math]::truncate(123456789/[math]::pow(1024,$i));$i++}&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Vladimír Meier</dc:creator><pubDate>Mon, 20 May 2013 16:04:53 -0000</pubDate></item><item><title>Re: #PSTip Validate your custom objects</title><link>http://www.powershellmagazine.com/2013/05/07/pstip-validate-your-custom-objects/#comment-900892565</link><description>&lt;p&gt;Nice trick, i was trying to add a function to generate a method on customobjec, but couldnt success, could you please give an example of it?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sahal</dc:creator><pubDate>Fri, 17 May 2013 22:29:23 -0000</pubDate></item><item><title>Re: #PSTip Finding the drive letter of a mounted disk image</title><link>http://www.powershellmagazine.com/2013/03/07/pstip-finding-the-drive-letter-of-a-mounted-disk-image/#comment-898730404</link><description>&lt;p&gt;Hi Ravikanth ,thanks i might need to use this , Is there a way to brouse  or read the vhd file without mounting it, I have a need to scan vhd drives on our virtual machines to find unlicensed software. cheers Dene&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dene Delower</dc:creator><pubDate>Wed, 15 May 2013 21:21:31 -0000</pubDate></item><item><title>Re: Better Restart-Computer cmdlet in PowerShell 3.0</title><link>http://www.powershellmagazine.com/2012/11/27/better-restart-computer-cmdlet-in-powershell-3-0/#comment-896889881</link><description>&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;and what if I have error&lt;/p&gt;

&lt;p&gt;Restart-Computer : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCE&lt;br&gt;SSDENIED))&lt;br&gt;At line:1 char:17&lt;br&gt;+ Restart-Computer &amp;lt;&amp;lt;&amp;lt;&amp;lt;  -computername WOC-dev-WD2&lt;br&gt;    + CategoryInfo          : NotSpecified: (:) [Restart-Computer], Unauthorized&lt;br&gt;AccessException&lt;br&gt;    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Power&lt;br&gt;Shell.Commands.RestartComputerCommand&lt;/p&gt;

&lt;p&gt;What shoul be checked or aded in to the command ?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Leon</dc:creator><pubDate>Tue, 14 May 2013 05:49:03 -0000</pubDate></item><item><title>Re: New PowerShell Book: PowerShell 3.0 Advanced Administration Handbook</title><link>http://www.powershellmagazine.com/2013/04/26/new-powershell-book-powershell-3-0-advanced-administration-handbook/#comment-895762937</link><description>&lt;p&gt;Does anyone have this book? I will be glad if you write a review.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Vladimír Meier</dc:creator><pubDate>Mon, 13 May 2013 07:18:41 -0000</pubDate></item><item><title>Re: #PSTip Working with the Windows.Forms.Screen Class</title><link>http://www.powershellmagazine.com/2013/05/09/pstip-working-with-the-windows-forms-screen-class/#comment-892948784</link><description>&lt;p&gt;Windows.Forms is used by C# or PowerShell to build graphical user interfaces, I don't see any reason why not to use them. Another option would be to use WPF.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ShayLevy</dc:creator><pubDate>Sat, 11 May 2013 06:28:59 -0000</pubDate></item><item><title>Re: #PSTip ValidatePattern – Friendlier error messages</title><link>http://www.powershellmagazine.com/2013/05/08/pstip-validatepattern-friendlier-error-messages/#comment-892910168</link><description>&lt;p&gt;I would stay it's v1 mandatory parameter... And currently: "force" mandatory parameter (unlike [Parameter(Mandatory)]), it won't prompt, it will fail. ;) But yes, this technique is pretty cool. :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bartek Bielawski</dc:creator><pubDate>Sat, 11 May 2013 04:26:06 -0000</pubDate></item><item><title>Re: #PSTip ValidatePattern – Friendlier error messages</title><link>http://www.powershellmagazine.com/2013/05/08/pstip-validatepattern-friendlier-error-messages/#comment-892909096</link><description>&lt;p&gt;For ValidateScript your best option may be just throw-ing cumstom message. :)&lt;br&gt;&lt;code&gt;function Boom {&lt;br&gt;param (&lt;br&gt;    [ValidateScript({&lt;br&gt;        throw "Ha! Default value is perfect! Why change it???"&lt;br&gt;    })]&lt;br&gt;    [string]$Bam = 'Perfect!'&lt;br&gt;)&lt;br&gt;    "It's $Bam!"&lt;br&gt;}&lt;/code&gt;&lt;br&gt;If you would try it with any parameter passed:&lt;br&gt;&lt;code&gt;Boom -Bam Awesome&lt;br&gt;Boom : Cannot validate argument on parameter 'Bam'. Ha! Default value is perfect! Why change it???&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bartek Bielawski</dc:creator><pubDate>Sat, 11 May 2013 04:22:08 -0000</pubDate></item><item><title>Re: #PSTip ValidatePattern – Friendlier error messages</title><link>http://www.powershellmagazine.com/2013/05/08/pstip-validatepattern-friendlier-error-messages/#comment-892620751</link><description>&lt;p&gt;param(&lt;/p&gt;

&lt;p&gt;    [String]$parameter = $(throw "parameter must be specified.")&lt;/p&gt;

&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;This is a pretty tricky way to have a default parameter.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">DVS</dc:creator><pubDate>Fri, 10 May 2013 17:49:25 -0000</pubDate></item><item><title>Re: #PSTip Working with the Windows.Forms.Screen Class</title><link>http://www.powershellmagazine.com/2013/05/09/pstip-working-with-the-windows-forms-screen-class/#comment-892393476</link><description>&lt;p&gt;What are your thoughts on building GUIs with PowerShell. Some people say that if you want a GUI use C# or an HTA. Are PowerShell GUIs ok to use, or are they not part of the "best practices?"&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">DVS</dc:creator><pubDate>Fri, 10 May 2013 13:03:43 -0000</pubDate></item><item><title>Re: #PSTip ValidatePattern – Friendlier error messages</title><link>http://www.powershellmagazine.com/2013/05/08/pstip-validatepattern-friendlier-error-messages/#comment-892117001</link><description>&lt;p&gt;Nice solution for regex validation. &lt;br&gt;For validation scripts in general, since the error message is going to display the validation script block, you can include helpful information by putting comment line in the validation script block, and it will be displayed in the error message.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rob Campbell</dc:creator><pubDate>Fri, 10 May 2013 07:42:05 -0000</pubDate></item><item><title>Re: PowerShell Summit 2013 session recordings</title><link>http://www.powershellmagazine.com/2013/05/08/powershell-summit-2013-session-recordings/#comment-891159756</link><description>&lt;p&gt;Groovy&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">DVS</dc:creator><pubDate>Thu, 09 May 2013 15:40:10 -0000</pubDate></item><item><title>Re: Provisioning and Licensing Office 365 Accounts with PowerShell</title><link>http://www.powershellmagazine.com/2012/04/23/provisioning-and-licensing-office-365-accounts-with-powershell/#comment-880528532</link><description>&lt;p&gt;Let's say I have a lot of users who were initially licensed with the E3 license above with everything except Exchange.  A year passes.  Now your business wants to use Exchange as well.  How would you add just the Exchange component to the existing licenses?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bryan</dc:creator><pubDate>Tue, 30 Apr 2013 12:16:45 -0000</pubDate></item><item><title>Re: #PSTip Enumerate all SQL Server instances in a network</title><link>http://www.powershellmagazine.com/2013/04/24/pstip-enumerate-all-sql-server-instances-in-a-network/#comment-874853961</link><description>&lt;p&gt;Yes, you are correct. I guess it was an issue with not copy / pasting the code and trying to type it in! :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ravikanth</dc:creator><pubDate>Wed, 24 Apr 2013 22:11:37 -0000</pubDate></item><item><title>Re: #PSTip Enumerate all SQL Server instances in a network</title><link>http://www.powershellmagazine.com/2013/04/24/pstip-enumerate-all-sql-server-instances-in-a-network/#comment-874740034</link><description>&lt;p&gt;I'm getting: &lt;br&gt;Add-Type -AssemblyName "Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"&lt;br&gt;[Microsoft.SqlServer.Management.Smo.SmoApplication]::EnumAvailableServers($true)&lt;/p&gt;

&lt;p&gt;Method invocation failed because [Microsoft.SqlServer.Management.Smo.SmoApplication] doesn't contain a method named 'EnumAvailableServers'.&lt;/p&gt;

&lt;p&gt;I think the method name should be: EnumAvailableSqlServers&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.smoapplication.enumavailablesqlservers.aspx" rel="nofollow"&gt;http://msdn.microsoft.com/en-u...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Elijah Gagne</dc:creator><pubDate>Wed, 24 Apr 2013 18:53:50 -0000</pubDate></item></channel></rss>