Monday, July 8, 2013

Migration of Netapp Filer in one geographic location whilst maintaining large snapmirror relationship with original destination.

I was upgrading a filer in one of our remote sites , part of the project called for the migration of our CIFS data , the CIFS volume contained over 1 TB of data and our link back to our Primary datacenter was 20Mbps. Snapping all of this data back down would have been a time consuming excersize
and needless waste of resources.

What follows are the high level steps i took to ensure that the new source filer replaced the old source filer in the snapmirror relation ship

Filer A = Old Regional Filer
Filer B = New Regional Filer
Filer C = Primary Datacentre Filer


1. Snapmirror relationship between FilerA(FilerAcifsvol1) already exists to FilerC(FilerAcifsvol1M)
2. Create Snapmirror relationship between FilerA(FilerAcifsvol1) and FilerB(FilerBcifsvol1)
3. Allow all Snapmirrors to become consistent
4. Change Snapmirror trigger to manual
5. Stop CIFS Service on FilerA
6. Perform final snapmirror in the following sequence
    FilerA(FilerAcifsvol1) ->FilerC(FilerAcifsvol1M)
    FilerA(FilerAcifsvol1) ->FilerB(FilerBcifsvol1)
   
Make sure that the correct snapshots exist on each filer
7. Quiesce and break  FilerA(FilerAcifsvol1) ->FilerB(FilerBcifsvol1) snapmirror relationship
8. Modify \\filerC\c$\etc\snapmirror.conf on FilerC as follows
    replace
   FilerA:FilerAcifsvol1 FilerC:FilerAcifsvol1M KBS=XXX ... ... ... ...
    With
  FilerB:FilerBcifsvol1 FilerC:FilerAcifsvol1M KBS=XXX ... ... ... ...

9. Putty  into filerC and execute the following command
   snapmirror update -S FilerB:FilerBcifsvol1 -w FilerC:FilerAcifsvol1M




Thursday, June 20, 2013

Powershell script to create a VLAN'd portgroup on vswitch0 for each ESX host in the appropriate cluster.


Connect-VIServer vcentreServer
$DublinSite1ProdHosts = get-vmhost | where-object {($_.parent -like "DublinCluster01")}
$DublinSite1ProdHosts | ForEach-Object {( get-vmhost $_.name ) | Get-VirtualSwitch -name "vswitch0" | New-VirtualPortGroup -Name Site1IsolatedObsoleteServers -VLanId 181 }


Connect-VIServer vcentreServer2
$DublinSite2ProdHosts = get-vmhost | where-object {($_.parent -like "DublinCluster02")}
$DublinSite2ProdHosts | ForEach-Object {( get-vmhost $_.name ) | Get-VirtualSwitch -name "vswitch0" | New-VirtualPortGroup -Name Site2IsolatedObsoleteServers -VLanId 182 }

Tuesday, June 4, 2013

PowerShell script to apply a specific GPO and disable another Specific GPO .

$ohewes = Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -searchbase 'ou=users,ou=users,ou=users,dc=ie,dc=companyname,dc=companyname,dc=com' -searchscope Onelevel | Where-object {$_.name -notlike "IT" -and $_.name -notlike "Unassigned*"}

$ohewes | ForEach-Object {
    New-GPLink -name "EncryptionCheck - UserPolicy" -target $_.DistinguishedName  -linkEnabled Yes
}

$ohewes | ForEach-Object { set-GPLink -name "OldEncryptionCheck - User Policy" -target $_.DistinguishedName  -linkEnabled no -whatif }

Wednesday, May 22, 2013

PowerShell script to refresh training environment to most recent snapshot

#Refreshes the training system to the latest snapshot
connect-viserver viserver
$PSEmailserver = "SMTP.companyname.com"
$CurrentTrainingSnap = (get-snapshot Appserver** | sort-object -Property Created -Descending | select-object -ExpandProperty Name -First 1)
Set-VM Appserver** -Snapshot $CurrentTrainingSnap -Confirm:$false
Send-MailMessage -From "emailaddress" -To "emailaddress" -cc "emailaddress" -Subject "Appserver** has been refreshed"
PowerShell script to check for unencrypted computers and send email alert

Computers log any decryption event to a log file , if the log file is older than a day
then the process is assumed to have failed , in this case an email is sent to our helpdesk system which automatically logs a call for the helpdesk staff to contact the end user and manually remediate the device

$PSEmailserver = "SMTP.emailserver.com"
$DateToCompare = (Get-date).addDays(-1)
$PathToCheck = "\\fileserver\emcryptionuninstall$\DecryptLimbo\"
$LimboComputers = get-childitem $PathToCheck | Where-object {$_.lastwritetime -lt $DatetoCompare}
$limbocomputers | ForEach-Object { Send-MailMessage -From "Security@company.ie" -To "me@company.ie" -cc "others@company.ie" -Subject "The following computer has not completed the encryption Process" -Body (get-content $_.fullname)}

Thursday, November 22, 2012

Unable to power off a VM , Hangs at 95%

I had a problem with a Dev Machine that had become completely unresponsive , we were unable to ping it , and unable to control it using vsphere.
I tried to power it down but the progress halted at 95% ,
I putty'd in to the host and tried to power it down using
vim-cmd vmsvc/getallvms and getting the  vmid
then
vim-cmd vmsvc/power.off XX i then checked the power state
vim-cmd vmsvc/power.getsate XX and found that the machine was still up

I then tried to pull the rug from under the VM by running

esxcli vm process list - obtained the worldID of the misbehaving VM
esxcli vm process kill --type=soft --world-id=XXXX
Checked powerstate with 
vim-cmd vmsvc/power.getsate XX - failed tried a hard kill

esxcli vm process kill --type=hard --world-id=XXXX-Failed again , so last  chance saloon

esxcli vm process kill --type=force --world-id=XXXX
 

Thursday, September 20, 2012

Netapp Powershell command to find all snapshots older than 28 days

1 Download dataontap PS module and extract to c:\windows\system32\windowspowershell\1.0\modules

2 Import the netapp powershell module
   Import-Module dataontap

3 define $28days as being todays date - 28 days
   $28days = (get-date).adddays(-28)

4 connect to the controller
   connect-nacontroller "controllername"

5 view the list of snapshots that are older than 28 days
   Get-Navol | Get-NaSnapshot | where-object { $_.name -like "smvi_*" -and $_.created -lt $28days }

6 See what snapshots will be deleted
   Get-Navol | Get-NaSnapshot | where-object { $_.name -like "smvi_*" -and $_.created -lt $28days }  | remove-nasnapshot -whatif

7 Delete the snapshots
     Get-Navol | Get-NaSnapshot | where-object { $_.name -like "smvi_*" -and $_.created -lt $28days }  | remove-nasnapsho