Geeks With Blogs
Points To Share Mostly SharePoint May 2013 Entries
SharePoint QuicLaunch Maker with PowerShell
At times I create so many sites and sub-sites that the Top-Nav cannot handle it. It is better to add the new links to the Quick Launch.The function below makes it a snap.Here is how it is used:The first line inserts a heading "OrgSites" under the "Lists" heading (already there) in the QuickLaunch. Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; ......

Posted On Sunday, May 19, 2013 12:44 PM

PowerShell Idiosyncrasy Explained
Doug Finke, A PowerShell MVP tested it in .Net where it fails as well. He explained that The call is ambiguous between the following methods or properties: 'System.Math.Floor(decimal)' and 'System.Math.Floor(double)' My understanding is that PowerShell convert variables as it "pleases". 1/5 will most likely convert to float. There maybe another approach to doing it w/o the [Math]::Floor. It is the format it with "{0:N0}", then use the D2 format. $i = 1 $j = "{0:N0}" -f $i/5 $k = "{0:D2}" -f $j AND ......

Posted On Sunday, May 19, 2013 10:59 AM

PowerShell Format Idiosyncrasy
Here is a piece of code I tested for the conversion of the numbers 0 thru 99 into 20 strings of exactly 2 digits. The first is 04, the next 09, then 14,19,24,29, etc. all the way to 94, 99. The code: "{0:D2}" -f $d formats each number to exactly 2 digits. The $i used in the “for” loop is interpreted by PowerShell – it automatically assigns it to a float. So when dividing by 5, we get fractions. I needed it to be whole numbers, hence the [math]::floor($i/5). cls for ($i = 0; $i -lt 100; $i++) { $n ......

Posted On Thursday, May 9, 2013 4:17 PM

Copyright © PointsToShare | Powered by: