scriptermad's Posts

Hi All We use vCD 5.5 (upgrading soon) and i was wondering if its possible to use vRA / vRO to create automation workflows for mundane tasks For example, would it be possible to automate th... See more...
Hi All We use vCD 5.5 (upgrading soon) and i was wondering if its possible to use vRA / vRO to create automation workflows for mundane tasks For example, would it be possible to automate the expansion of a disk in vCD for a VM and then extend the disk in the OS also ? Thanks for any help
no as vmotion is a vCenter led process and for that you need powercli and not esxcli
press alt and F12 on the esxi console while this issue is happening and you will see real time logging, it could help you to see if there are storage errors
Hi I am trying to stop some VM's in vCD using a txt file. I am doing the following 1. Connecting to vCD 2. $vmlist = get-contect c:\vms,txt 3. $vms = get-civm $vmlist   But the l... See more...
Hi I am trying to stop some VM's in vCD using a txt file. I am doing the following 1. Connecting to vCD 2. $vmlist = get-contect c:\vms,txt 3. $vms = get-civm $vmlist   But the last command gives an error "CIVM with name 'correct vm name read from file' was not found using the specified filter Any idea how to run script to shut down VM's in vCD ?
they are all windows 2008 / 2012 Thanks ,will give it a try and let you know
Hi All Currently i have a resource pool where the VM's only have one DNS entry I need to create a script to add the second DNS entry (not change the first one, just leave it as it is) I ... See more...
Hi All Currently i have a resource pool where the VM's only have one DNS entry I need to create a script to add the second DNS entry (not change the first one, just leave it as it is) I have started with the below  to connect to VC, take the resouce pool in question and get all the VM's in that resource pool. Then for each VM in vms i will run an invoke vmscript command , does anyone how the syntax to add the second dns server ? # Connect to vCenter silently # try { Write-Host "Connecting to..." $vCenter -ForegroundColor Yellow Connect-VIServer -Server $vCenter -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null if ($? -eq $false) {throw $error[0].exception} } catch [Exception]{ exit } $rp = Read-Host -Prompt "What Resource Pool do you want to gather information for " $vms = get-resourcepool -Name $rp | get-vm | where {$_.Powerstate -eq 'Poweredon'} foreach ($vm in $vms){ invoke-vmscript -vm $vm -ScriptText ...... }
awesome, thanks
Thanks guys I added the | get-view but not getting this error does not contain a method named 'op_addition' At c:\users\mleahy\desktop\script.ps1:42 char :13 $finalresult +=4object
Hi All I am using the script provided here VMs Disk Usage Report  to retrieve the disk usage information in my environments. I have altered it slightly but am getting this error : Attempted... See more...
Hi All I am using the script provided here VMs Disk Usage Report  to retrieve the disk usage information in my environments. I have altered it slightly but am getting this error : Attempted to divide by zero. PS1:28 char :13 Attempted to divide by zero  PS1:56 char : 9 Any idea whats wrong ? #import-module vmware.vimautomation.core $viserver = read-host "please enter your vCenter hostname / IP" $cred = get-credential connect-viserver $viserver -Credential $cred $rp = read-host -Prompt "What resource pool do you want to gather information for" $vms = get-resourcepool -Name $rp | get-vm | where {$_.PowerState -eq 'Poweredon'} $FinalResult = foreach($vm in $vms){        $totalCapacity = $totalFree = 0        $vm.Guest.Disk | %{             $object = New-Object -TypeName PSObject             $Capacity = "{0:N0}" -f [math]::Round($_.Capacity / 1MB)             $totalCapacity += $_.Capacity             $totalFree += $_.FreeSpace             $Freespace = "{0:N0}" -f [math]::Round($_.FreeSpace / 1MB)             $Percent = [math]::Round(($FreeSpace)/ ($Capacity) * 100)             $PercentFree = "{0:P0}" -f ($Percent/100)             $object | Add-Member -MemberType NoteProperty -Name "Server Name" -Value $vm.Name             $object | Add-Member -MemberType NoteProperty -Name Disk -Value $_.DiskPath             $object | Add-Member -MemberType NoteProperty -Name "Capacity MB" -Value $Capacity             $object | Add-Member -MemberType NoteProperty -Name "Free MB" -Value $FreeSpace             $object | Add-Member -MemberType NoteProperty -Name "Free %" -Value $PercentFree             $finalResult += $object         }         $object = New-Object -TypeName PSObject         $object | Add-Member -MemberType NoteProperty -Name "Server Name" -Value $vm.Name         $object | Add-Member -MemberType NoteProperty -Name Disk -Value 'SubTotal'         $object | Add-Member -MemberType NoteProperty -Name "Capacity MB" -Value ("{0:N0}" -f ($totalCapacity/1MB))         $object | Add-Member -MemberType NoteProperty -Name "Free MB" -Value ("{0:N0}" -f ($totalFree/1MB))         $object | Add-Member -MemberType NoteProperty -Name "Free %" -Value ("{0:P0}" -f ($totalFree/$totalCapacity))         $finalResult += $object     } $finalResult | Export-Csv "C:\DiskUsageReport.csv" -NoTypeInformation  -UseCulture    # dump the report to .csv
Hi All I am looking to automate some tasks that we do in vcloud director , like extending disk sizes etc. Is it possible to use powercli for this ? or would i need to use invoke-vmscript t... See more...
Hi All I am looking to automate some tasks that we do in vcloud director , like extending disk sizes etc. Is it possible to use powercli for this ? or would i need to use invoke-vmscript to actually expand the disk size in the guest OS? Thanks for any help
Hi All I am looking to try and create a script that i can use to connect to vCD, find a VM in a vORG , extend the disk and also extend the disk inside the guest OS. Is this possible or woul... See more...
Hi All I am looking to try and create a script that i can use to connect to vCD, find a VM in a vORG , extend the disk and also extend the disk inside the guest OS. Is this possible or would i have to increase the disk size via vCD and then use invoke vm command to extend the disk in the guest OS ? Thanks for any help
Awesome - thanks very much . Works perfect
Copied and ran that script and still getting errors..Here is the output running on two different VM's PS C:\Users\> E:\getdns\test.ps1 DNS1                                                ... See more...
Copied and ran that script and still getting errors..Here is the output running on two different VM's PS C:\Users\> E:\getdns\test.ps1 DNS1                                                             IP                                                               DNS2                                                            vm                                                             ----                                                             --                                                               ----                                                            --                                                                                                                              At line:4 char:92...                                                                                                             toolstest2        PS C:\Users\> E:\getdns\test.ps1 WARNING: The version of VMware Tools on VM 'dtmat11-testa1 (e59ff307-ba94-4742-91ff-842fddb6d2fc)' is out of date and may cause Invoke-VMScript to work improperly. DNS1                                                             IP                                                               DNS2                                                            vm                                                             ----                                                             --                                                               ----                                                            --                                                             where{$_.dnsserversearchorder}                                  Unexpected token '1' in expression or statement....               select -expandproperty dnsserve... I know this is dragging on but its very close and i would love to get it working !                            
Here you go, script attached
ok so now this is what i have $vm=get-vm -Name "toolstest2 (42e19988-df7f-45a6-8025-9b48da889e0f)" $shownet = @' $net = get-wmiobject win32_networkadapterconfiguration "{0}|{1}|... See more...
ok so now this is what i have $vm=get-vm -Name "toolstest2 (42e19988-df7f-45a6-8025-9b48da889e0f)" $shownet = @' $net = get-wmiobject win32_networkadapterconfiguration "{0}|{1}|{2}" -f @(($net | where{$_.IPaddress} | select -expandproperty IPaddress | where{$_ -notmatch ':'}),                        @($net | where{$_.dnsserversearchorder} | select -expandproperty dnsserversearchorder) [0],                        @($net | where{$_.dnsserversearchorder} | select -expandproperty dnsserversearchorder) [1])                       '@ $result = invoke-vmscript -vm $vm -ScriptText $shownet -ScriptType powershell | select -ExpandProperty scriptoutput $resultarray = $result.Trimend("'r'n").Split('|') new-object PSObject -Property @{     vm = $vm.name     IP = $resultarray[0]     DNS1 = $resultarray[1]     DNS2 = $resultarray[2]     } And this is the output DNS1                                                             IP                                                               DNS2                                                            vm                                                             ----                                                             --                                                               ----                                                            --                                                                                                                              At line:4 char:3...                                                                                                              toolstest2 (42e19988-df7f-45a6-8025-9b4
Thanks. havent had a chance to try this yet. WIll revert once i do
Thanks .That works a treat on the VM i am testing with I then ran it against another VM (same OS and version of tools) which has only one DNS server and it outputted this - is this expected w... See more...
Thanks .That works a treat on the VM i am testing with I then ran it against another VM (same OS and version of tools) which has only one DNS server and it outputted this - is this expected when only one DNS ? DNS1                                                             IP                                                               DNS2                                                            vm                                                             ----                                                             --                                                               ----                                                            --                                                             1                                                                192.168.111.12                                                   7...                                                            Correct-name   
so this what i have at the moment (just running on one VM for now) $vm=get-vm -Name "toolstest2 (42e19988-df7f-45a6-8025-9b48da889e0f)" $shownet = @' $net = get-wmiobject win32_n... See more...
so this what i have at the moment (just running on one VM for now) $vm=get-vm -Name "toolstest2 (42e19988-df7f-45a6-8025-9b48da889e0f)" $shownet = @' $net = get-wmiobject win32_networkadapterconfiguration "{0}|{1}|{2}" -f @(($net | where{$_.IPaddress | select -expandproperty IPAddress | where{$_ -notmatch ':'}),                        ($net | where{$_.dnsserversearchorder} | select -expandproperty dnsserversearchorder)[1],                        ($net | where{$_.dnsserversearchorder} | select -expandproperty dnsserversearchorder)[2]) '@ $report $result = invoke-vmscript -vm $vm -ScriptText $shownet -ScriptType powershell | select -ExpandProperty scriptoutput $resultarray = $result.Trimend("'r'n").split('|') new-object PSObject -Property @{     VM = $vm.name     IP = $resultarray[0]     DNS1 = $resultarray[1]     DNS2 = $resultarray[2]        } This is the output NS1                                       IP                                         DNS2                                       VM                                       ----                                       --                                         ----                                       --                                       {1}                                        At line:2 char:33...                       {2}" -f @(($net                            toolstest2 (42e19988-df7f-45a6-8025-9b...
no change All i am getting is vmname and DNS1 DNS2 is blank and IP says system.object[]
yep . it returns 192.168.100.115 ipv6 address