Monthly Archives: November 2011

Create a new Equallogic volume via PowerShell

I have been playing around with Powershell, and thought I would write a basic little function to create a new volume.

Function eqlNewVol
{
param ([string]$grpName,[string]$volname, [decimal]$gb, [string]$strPool, [string]$VolumeDesc, [bool]$tp) 
write-debug "Beginning Script, calling new-eqlvolume"
write-debug "$grpname, $volname, $gb, $strpool, $VolumeDesc, $tp"

new-eqlvolume -groupname $grpname -volumeName $volname `
-volumesizeMB ($gb * 1048576) `
-storagepoolname $strPool `
-AllowMultipleInitiators $True `
-Volumedescription $VolumeDesc `
-thinprovision $tp 
write-debug "new-eqlvolume called"

#Add permissions from a file called c:\initiators.csv
write-debug "Setting permissions"
(get-content c:\initiators.csv) `
| foreach-object {new-eqlvolumeACL -volumeName $volname –InitiatorName $_ -AclTargetType volume_and_snapshot}
}

Basically, it will take command line arguments to create a new volume, and then add initiators based on name, taken from a file called c:\initiators.csv.

You would probably want to connect first, when you can do with the “connect-eqlgroup” command, you can then call the function using something like this:

eqlNewVol MySANGroup, NewVol1, 1.95, myPool, 0

First though, you need to load the function to make it accessible. If the function is stored in (say) myfunctions.ps1, you will need to load this (. ./myfunctions.ps1) before you can call it. Not that dot space dot forwardslash file syntax.

Oh, and you will of course need the the Equallogic powershell plugin’s.

1 Comment

Filed under Equallogic, Powershell

Updates

I am glad this isn’t one of my own personal machines… A security update waiting to be installed since Feb 2002.

Leave a comment

Filed under Microsoft

Broadband provider

Not that I would criticize my ISP, but this is just ridiculous. It has been like this for a while now:

Before my ISP were taken over by talktalk, I don’t ever remember it being this bad..

Leave a comment

Filed under talktalk

Using Powershell to check for hotfixes

OK, nothing really new here to anyone who has played much with powershell but I gave myself a pat on the back for it.

If you want to check what hotfixes are installed on your machines, you can use the following command:

( get-adcomputer -filter *) | ForEach-Object -process {out-file -filepath c:\hotfixes.txt -append -inputobject (get-hotfix -computer $_.Name)}

Of course that is going to return a pretty long list if you have a lot of machines and/or hotfixes, so if you only wanted to check computers who names start with “server”, you could do:

( get-adcomputer -filter  ‘Name -like “server*”‘) | ForEach-Object -process {out-file -filepath c:\hotfixes.txt -append -inputobject (get-hotfix  -id KB976902 -computer $_.Name)}

And if you only want to check for a specific hotfix on those servers, you could do

( get-adcomputer -filter  ‘Name -like “server*”‘) | ForEach-Object -process {out-file -filepath c:\hotfixes.txt -append -inputobject (get-hotfix  -id KB976902 -computer $_.Name)}

It should of course have some error handling make sure that the ActiveDirectory module is loaded (you can check by running “Get-module -list”).

You do NOT need powershell installed on your target workstations/servers for this to work!

 

Leave a comment

Filed under Powershell, Windows 2008