I had a need to store some user data. Using the Exchange 2010 Management Shell I could use Get-User and Get-Mailbox to get what I needed, but when you export it to CSV, some of the fields don’t export very well at all.I was looking at all kinds of funky ways to export the data, but then stumbled upon Export-Clixml.
I was amazed. I could run say Get-Mailbox bob | Export-Cixml bob.xml Then I could run $x = Import-Clixml bob.xml anywhere and I would have a variable ($x) with bob’s mailbox information in! How cool is that! |
Month: July 2014
#NetApp DataOnTap and Invoke-NaSysstat
So I have been play with the NetApp DataOnTap add in for a while now want to share this. Essentially all it does is run Invoke-NaSysstat at timed intervals and saves it to an hourly csv file
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') $filer = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the comma seperated filer name", "Enter Filer Name", "") #Change to match you path Import-Module E:\PsMON\netapp\DataONTAP.psd1 Connect-NaController $Filer -Credential root $matrix = @() $doit = $True $timer = 10 $LastHour = (Get-Date -format "HH") while($doit){ $ThisHour = (Get-Date -format "HH") $tSysStat = Invoke-NaSysstat -Count 1 | Select $tSysStat $matrix += $tSysStat If($ThisHour -ne $LastHour){ $outFile = $filer + "_" + (Get-Date -format "yyyy-MM-dd_HHmm") + ".csv"; $Matrix | Export-Csv $outFile -NoTypeInformation;$matrix = @(); "-$outFile-" } $LastHour = $ThisHour For($i=0;$i-le $timer;$i++){Sleep 1 } } $outFile = $filer + "_" + (Get-Date -format "yyyy-MM-dd_HHmm") + ".csv";$Matrix | Export-Csv $outFile -NoTypeInformation |