Categories

Monthly Archives: August 2014

Grains of rice on a chess board

There is a story about the inventor of chess being rewarded by putting 1 grain of rice on the first square of the board; 2 on the second and so on.  How much rice does that come to?


 


The total number of grains is 1.84467440737096E+19


 


At 25mg per grain thats 461168601842739 kilogrammes of rice


 


Which in more understandable terms is:


 


461,168,601,842.739 metric tonnes


 


or


453,886,749,619.642 tons


 


That’s a lot of rice


 


If you want to play around with the numbers the calculations are:


 


[double]$result = 0


1..64 |
foreach {
 
$square = [math]::Pow(2, ($psitem -1))
$result += $square


}


$wt = 0.025


$totalweight = ($wt * $result)/1000
$totalweight


$mtwt = $totalweight /1000
$mtwt


$tons = $totalweight * 0.00098421
$tons



Source: Richard Siddaway

Grains of rice on a chess board

There is a story about the inventor of chess being rewarded by putting 1 grain of rice on the first square of the board; 2 on the second and so on.  How much rice does that come to?

 

The total number of grains is 1.84467440737096E+19

 

At 25mg per grain thats 461168601842739 kilogrammes of rice

 

Which in more understandable terms is:

 

461,168,601,842.739 metric tonnes

 

or


453,886,749,619.642 tons

 

That’s a lot of rice

 

If you want to play around with the numbers the calculations are:

 

[double]$result = 0

1..64 |
foreach {
 
$square = [math]::Pow(2, ($psitem -1))
$result += $square

}

$wt = 0.025

$totalweight = ($wt * $result)/1000
$totalweight

$mtwt = $totalweight /1000
$mtwt

$tons = $totalweight * 0.00098421
$tons

Event Log Providers

An event log provider is writes to an event log.  I’ve used WMI in the past to get these but while looking for somethign else discovered that Get-WinEvent can also find this information

 

Get-WinEvent -ListProvider * | ft Name, LogLinks -AutoSize –Wrap

 

Provides a nice long list of all of the providers and the event logs they write to.

 

Usually I’m only interested in what’s writing to a particular event log. And that’s where things get a bit more messy.

 

The loglinks are supplied as a System.Collections.Generic.IList[System.Diagnostics.Eventing.Reader.EventLogLink] LogLinks  object that doesn’t play nicely with –in or –contains

 

So we need a bit of PowerShell manipulation to get what we want

 

$log = 'System'

Get-WinEvent -ListProvider * |
foreach {
 
if ($log -in ($psitem | select -ExpandProperty Loglinks | select -ExpandProperty Logname)){
    New-Object -TypeName psobject -Property @{
      Name = $psitem.Name
      Log = $log
    }
}
}

 

The trick here is that the loglinks are a collection of objects so you need to expand them twice to get to the name.  Not pretty but it works

Event Log Providers

An event log provider is writes to an event log.  I’ve used WMI in the past to get these but while looking for somethign else discovered that Get-WinEvent can also find this information


 


Get-WinEvent -ListProvider * | ft Name, LogLinks -AutoSize –Wrap


 


Provides a nice long list of all of the providers and the event logs they write to.


 


Usually I’m only interested in what’s writing to a particular event log. And that’s where things get a bit more messy.


 


The loglinks are supplied as a System.Collections.Generic.IList[System.Diagnostics.Eventing.Reader.EventLogLink] LogLinks  object that doesn’t play nicely with –in or –contains


 


So we need a bit of PowerShell manipulation to get what we want


 


$log = ‘System’


Get-WinEvent -ListProvider * |
foreach {
 
if ($log -in ($psitem | select -ExpandProperty Loglinks | select -ExpandProperty Logname)){
    New-Object -TypeName psobject -Property @{
      Name = $psitem.Name
      Log = $log
    }
}
}


 


The trick here is that the loglinks are a collection of objects so you need to expand them twice to get to the name.  Not pretty but it works



Source: Richard Siddaway

Patching Server Core

I’ve been rebuilding my test lab after installing a SSD into the machine running it in place of the SATA drive.  Huge improvement in load speed of virtual machines – well worth the cost.

I usually have a number of server core machines in the lab and use WSUS for patching.  One issue I’d never really resolved was patching those server core machines  - the control panel fro Windows Update isn’t available!

Finally found a solution in the Windows Update PowerShell module from

http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

Install the module and then you can install your patches using

Get-WUInstall –AcceptAll

I’m running Windows 2012 R2 on all my servers so the modules auto load

Patching Server Core

I’ve been rebuilding my test lab after installing a SSD into the machine running it in place of the SATA drive.  Huge improvement in load speed of virtual machines – well worth the cost.


I usually have a number of server core machines in the lab and use WSUS for patching.  One issue I’d never really resolved was patching those server core machines  – the control panel fro Windows Update isn’t available!


Finally found a solution in the Windows Update PowerShell module from


http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc


Install the module and then you can install your patches using


Get-WUInstall –AcceptAll


I’m running Windows 2012 R2 on all my servers so the modules auto load



Source: Richard Siddaway

European Summit deadline approaching

There are just over two weeks left for you to register for the European PowerShell Summit. At the moment we are still short of the number that would enable us to repeat a European Summit in 2015.  We had a lot of comments from people stating they wanted a Summit in Europe.  Now is the time to step up and support that idea.


Hope to see you there



Source: Richard Siddaway

European Summit deadline approaching

There are just over two weeks left for you to register for the European PowerShell Summit. At the moment we are still short of the number that would enable us to repeat a European Summit in 2015.  We had a lot of comments from people stating they wanted a Summit in Europe.  Now is the time to step up and support that idea.

 

Hope to see you there

DSC Resource Kit–wave 6

The next wave of the DSC resource kit is available with some new resources and updates to old favourites.

Details from:

http://blogs.msdn.com/b/powershell/archive/2014/08/20/dsc-resource-kit-wave-6-is-here.aspx

DSC Resource Kit–wave 6

The next wave of the DSC resource kit is available with some new resources and updates to old favourites.


Details from:


http://blogs.msdn.com/b/powershell/archive/2014/08/20/dsc-resource-kit-wave-6-is-here.aspx



Source: Richard Siddaway