Open Indiana Cheats

Network the easy way
ifconfig e1000g0 plump
ifconfig e1000g0 addif 192.168.1.0/24 up
cat /etc/resolv.conf

Tools up in this bitch
2 cd /media
4 cd VMware\ Tools/
8 cp vmware-solaris-tools.tar.gz /home/aharrington/
9 cd /home/aharrington/
10 gunzip vmware-solaris-tools.tar.gz
11 mkdir temp
24 mv vmware-solaris-tools.tar temp/
28 tar -xvf vmware-solaris-tools.tar
31 cd vmware-tools-distrib/
32 ./vmware-install.sh -d

zfs commands are else where 🙂

Stage 4, no power :(

[powershell]
add-pssnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
Connect-VIServer vcenter.alanrocks.com
#stage 4, we are fucked, and probably wont get power back. kill them all.
$hoeson = (get-vmhost | where {$_.Powerstate -eq "PoweredOn"})
$hoeson | Stop-VMHost -Confirm:$false -Force:$true
[/powershell]

Stage 3, Getting low on power....

Hell, where even going to stop a host now...
[powershell]
add-pssnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
Connect-VIServer vcenter.alanrocks.com
#stage 3, now we are running leaning, and also fuck a host for good measure
$vmsilike = "dc1","vcenter","exchange2010","sql"
$vmson = (get-vm | where {$_.powerstate -eq "PoweredOn"})
$dievms = ($vmson -like $vmsilike)
foreach ($vmso in $vmson){if ($vmsilike -notcontains $vmso.Name){
# debug Write-Host $vmso.name "shut this bitch down"}}
$fvm = Get-VM $vmso
#findtoolsver
$toolver = (get-vm $fvm |% {get-View $_.id} | select @{Name="toolsver"; expression={$_.config.tools.toolsversion}})
if ($toolver.toolsver -gt 10000){$fvm | Stop-VM -Confirm:$false}
if ($toolver.toolsver -le 10000){$fvm | Shutdown-VMGuest -Confirm:$false}
}}
$ho = get-vmhost esx-02*
$clu = get-cluster -vmhost $ho
$task = $ho | Set-VMHost -Evacuate:$true -State "Maintenance" -RunAsync
Get-DrsRecommendation -Cluster $clu | where {$_.Reason -eq "Host is entering maintenance mode"} | Apply-DrsRecommendation
$host = Wait-Task $updateHostTask
$ho | Stop-VMHost -Confirm:$false -Force:$true
[/powershell]

Stage 2 Shutdown vm's we sorta care about

[powershell]
add-pssnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
Connect-VIServer vcenter.alanrocks.com
#stage 2, shutdown or stop vm's not on this list
$vmsilike = "dc1","vcenter","dc2","files","exchange2010","sql","wordpress-win"
$vmson = (get-vm | where {$_.powerstate -eq "PoweredOn"})
$dievms = ($vmson -like $vmsilike)
foreach ($vmso in $vmson){if ($vmsilike -notcontains $vmso.Name){
# debug Write-Host $vmso.name "shut this bitch down"}}
$fvm = Get-VM $vmso
#findtoolsver
$toolver = (get-vm $fvm |% {get-View $_.id} | select @{Name="toolsver"; expression={$_.config.tools.toolsversion}})
if ($toolver.toolsver -gt 10000){$fvm | Stop-VM -Confirm:$false}
if ($toolver.toolsver -le 10000){$fvm | Shutdown-VMGuest -Confirm:$false}
}}
[/powershell]

Stage 1 shutdown for UPS, the vm's we don't care about

Stage 1, shutdown down vm's we don't care about
[powershell]
add-pssnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
Connect-VIServer vcenter.alanrocks.com
#stage 1, shutdown or stop vm's not on this list
$vmsilike = "dc1","vcenter","VPNstuff","quickbooks","dc2","files","wordpress-win","exchange2010","sharepoint","sql"
$vmson = (get-vm | where {$_.powerstate -eq "PoweredOn"})
$dievms = ($vmson -like $vmsilike)
foreach ($vmso in $vmson){if ($vmsilike -notcontains $vmso.Name){
# debug Write-Host $vmso.name "shut this bitch down"}}
$fvm = Get-VM $vmso
#findtoolsver
$toolver = (get-vm $fvm |% {get-View $_.id} | select @{Name="toolsver"; expression={$_.config.tools.toolsversion}})
if ($toolver.toolsver -gt 10000){$fvm | Stop-VM -Confirm:$false}
if ($toolver.toolsver -le 10000){$fvm | Shutdown-VMGuest -Confirm:$false}
}}
[/powershell]

check exchange replication - powershell task

a client had some wan issues, the exchange dag didn't like it, this script will detect and resume automagically 🙂
[powershell]
$h = Get-MailboxDatabaseCopyStatus -ident "Main Database\EXCHANGE-DR"
$c = $h.CopyQueueLength
$s = $h.Status
if ($c -gt 0){
Resume-MailboxDatabaseCopy -Identity "Main Database\EXCHANGE-DR" -ReplicationOnly -confirm:$false
Write-Host "Resuming"}
elseif ($c -eq 0){Write-Host "we are good"}
if ($s -ne "Healthy"){
Resume-MailboxDatabaseCopy -Identity "Main Database\EXCHANGE-DR" -ReplicationOnly -confirm:$false
write-host "Detected not Healthy status, resuming"}
[/powershell]

WordPress Themes