Search found 59 matches

by obrienc
Thu Jul 20, 2017 12:10 pm
Forum: PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 6209

Re: Scheduled task parameter

Thank you. Would there be some difference other than method between extracting the message and parsing it vs parsing the xml? I ask because if I parse the xml to get a VM name and save it to a variable it shows System.String. If I do the same from a message it says System.String but the variable fro...
by obrienc
Thu Jul 20, 2017 7:51 am
Forum: PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 6209

Scheduled task parameter

I am writing a script to run a scheduled task on an event ID. There are 5 servers involved. 4 of them are hyper-v nodes that forward and event ID to a collector. The script then runs against the node from the collector to set some VM settings. I want to pull out the nodename sending the event and in...
by obrienc
Wed Jun 14, 2017 12:58 pm
Forum: PowerShell
Topic: [Math]::Round
Replies: 3
Views: 2236

Re: [Math]::Round

thanks
by obrienc
Wed Jun 14, 2017 10:13 am
Forum: PowerShell
Topic: [Math]::Round
Replies: 3
Views: 2236

Re: [Math]::Round

It would look something like this $v = $vm.MemoryAssigned|Measure -Character|Select -ExpandProperty Characters if ($v -le 9){ $Sheet2.Cells.Item($intRow, 4) = [Math]::Round(($vm.MemoryAssigned/ 1MB)) } if ($v -ge 10){ $Sheet2.Cells.Item($intRow, 4) = [Math]::Round(($vm.MemoryAssigned/ 1GB)) }
by obrienc
Wed Jun 14, 2017 9:54 am
Forum: PowerShell
Topic: [Math]::Round
Replies: 3
Views: 2236

[Math]::Round

I am fetching information about VMs, memory in particular. Some of the VMs have less than a gb and so I do a [Math]::Round(($vm.MemoryAssigned/ 1MB)) to give a nice readable number. I also have VMs with much more memory so I do a [Math]::Round(($vm.MemoryAssigned/ 1GB)) These VMs can live on the sam...
by obrienc
Fri May 26, 2017 12:17 pm
Forum: PowerShell
Topic: PSSession
Replies: 2
Views: 2146

Re: PSSession

For anyone who gets this error. ERROR: Rename-Computer : Cannot establish the WMI connection to the computer 'WIN-' with the following error message: The RPC server is unavailable. WMI service is running RPC Service is running I ran this on the template and it works as intended. Thank you jvierra. n...
by obrienc
Fri May 26, 2017 10:44 am
Forum: PowerShell
Topic: PSSession
Replies: 2
Views: 2146

PSSession

I wrote a script in the ISE that works but it doesn't in PSStudio. This is the script. It takes the vm name on hyper-v and finds the guest windows name WIN-something after a sysprep and then renames it to the VMName. $n = "Web1" $x = Get-VMNetworkAdapter -ComputerName OWCVHOST -VMName $n |...
by obrienc
Sat May 20, 2017 5:34 pm
Forum: PowerShell GUIs
Topic: Combobox variable for memory set GB, MB, KB
Replies: 29
Views: 11572

Re: Combobox variable for memory set GB, MB, KB

Set-Vm doesn't work, not sure if you saw my comment above. It works in the ISE Set-VM -ComputerName $s1 -Name $a$_ -DynamicMemory -MemoryMinimumBytes ($combobox4.SelectedItem.Value) Set-VMMemory works Set-VMMemory -ComputerName $s1 -Name $a$_ -DynamicMemory -MemoryMinimumBytes ($combobox4.SelectedIt...
by obrienc
Fri May 19, 2017 2:27 pm
Forum: PowerShell GUIs
Topic: Combobox variable for memory set GB, MB, KB
Replies: 29
Views: 11572

Re: Combobox variable for memory set GB, MB, KB

Works in ISE , Works in PSStudio Set-VM -ComputerName $s1 -Name $a$_ -DynamicMemory -MemoryMinimumBytes [b]4GB[/b] Does not work in PSStudio [b]Set-VM[/b] -ComputerName $s1 -Name $a$_ -DynamicMemory -MemoryMinimumBytes [b]$vmem[/b] Works in PSStudio [b]Set-VMMemory[/b] -ComputerName $s1 -VMName $a$_...
by obrienc
Fri May 19, 2017 2:22 pm
Forum: PowerShell GUIs
Topic: Combobox variable for memory set GB, MB, KB
Replies: 29
Views: 11572

Re: Combobox variable for memory set GB, MB, KB

Please see my last I was editing when you posted. I posted how it looked in the ISE but for some reason didn't work in PSStudio. Actually, Set-Vm works when you hardcode the 4GB just not with the variable.