Script to find the virtual computer off for more than 7 days
Guys,
I need a bit help I'm looking for a script that finds all the VMs who have been turned off for more than 7 days. I would like also the names of those VM and how many days they have been turned off for a worksheet excel output.
Thanks in advance.
Sorry, my mistake.
The correct script is now attached to the previous response
Tags: VMware
Similar Questions
-
Virtual machines off for more than 14 days
I so need of report of all virtual machines off the power more than 14 days and that turns off the virtual computer. I can get the power out of VMs. I can get that them turned off. But when I enter the list of the powered of VMs and who fed the, I'm missing the name of the virtual machine. I guess I'm missing something simple
Get - vm | where {$_.powerstate - eq "PoweredOff"} | Get-VIEvent | where {$_.fullFormatted Message - like "task: turning off *"} | Select Createduserid, username, fullFotmattedMessage | where {$_.createdtime - lt (get-date).adddays(-14)}
Try like this
get-vm | where {$_.powerstate -eq "PoweredOff"} |Get-VIEvent | where { $_.fullFormatted Message -like "Task: Power off*" } | select createdTime, userName, fullFotmattedMessage,@{N="VM";E={$_.Vm.Name}} | where {$_.createdtime -lt (get-date).adddays(-14)}
-
Need help with script to find the virtual computer by IP
Looking for a script that will correspond to the vm to IP, but should be able to find several IPS at the same time.
I put this together from scripts on the net, which works well to search for a single IP address at a time:
$match_address = Read-Host "enter the IP address to find."
Get - VM | %{
$vmips = $_. Guest.IPAddress
{foreach ($ip in $vmips)
If ($ip - as $match_address) {}
"VM found correspondence address: {0}" f $_. Name
}
}
}
But would need to be able to enter several IP addresses of different subnets in the $match_address and search script for a match for every ip address.
Could you please try this?
function search-VMAssociatedToIP {}
(param
$ArrayOfIPToCheck
)
{in process
$VMsAndAssociatedIP = get-view - viewtype 'virtualmachine ' | {foreach-object
$VM = $_
$_.guest.net | {foreach-object
$Net = $_
$_. IpAddress | {foreach-object
$IpAddress = $_
$Output = New-Object-Type PSObject-Prop ([ordered] @ {}
"VM" = $VM. Name
"NetworkName" = $Net.Network
"IP address" = $IpAddress
})
Return $Output
}
}
}
$ArrayOfIPToCheck | {foreach-object
$IPtoCheck = $_
$VMsAndAssociatedIP | where {$_.} IpAddress - eq $IPtoCheck} | {foreach-object
$Output = New-Object-Type PSObject-Prop ([ordered] @ {}
"IpToCheck" = $IPtoCheck
'VM' = $_. VM
"NetworkName" = $_.NetworkName
'IpAddress' = $_. IpAddress
})
Return $Output
}
}
}
}
$MyArray = "10.0.33.1","10.0.30.11","10.0.20.11","10.0.32.1".
Search for VMAssociatedToIP - ArrayOfIPToCheck $MyArray | OGV
Use a table entry.
First get the IP addresses of all computers installed correctly (only for virtual machines with VMware tools) virtual based on get - view so the collection will be fast.
Then compare with the PPE provided as input.
-
Windows 7 Ultimate, tried to install the upgrade of windows 10, now, my computer tells me always that Windows 7 is not an authentic, computer copy for more than a year don't never had a problem before.
I suggest that you run the Microsoft Genuine Advantage diagnostic tool in normal mode (not safe mode) and copy and paste the results into a response for further analysis:
http://go.Microsoft.com/fwlink/?LinkId=52012
Run the tool and when it ends, click the copy button, open a text such as Word or Notepad file and select Edit, paste. You can paste directly into an answer here. Open a response, right click and select Paste.
-
Windows Update is stuck on the screen check updates for more than an hour.
Original title: Windows Update problems
I just got a new update for Windows 7 and got all my drivers installed. However, Windows Update is stuck on the screen check updates for more than an hour. Everything works except that, and I don't know how to fix it. It has updated two things: the Windows Update Agent 7.6.7600.320 and update for Windows (KB958488). He continues to seek constantly and never find anything.
Please leave for 5 or 6 hours and if he doesn't find anything:
Please run the Windows Update Troubleshooter:
http://go.Microsoft.com/?linkid=9830262Please provide details of any problem it reports as not fixed.
-
Why should I return my password every time I have to leave my computer idle for more than 30 seconds?
Why should I return my password every time I have to leave my computer idle for more than 30 seconds?
You set your options of power that computer goes to screen saver if you left computer idle for 30 minutes?
If so, and if you don't want to enter password once again, this...Start button > in the search box, type screensaver > press enter > in the settings window of the screensaver, uncheck "On summary, the logon screen" > click OK when finished.
-
Phone has been "redevelopment" iCloud drive for more than a day now
In parameters, iCloud Drive was churning "valorisation" for more than a day now. Did not help restart the phone. iPhone 6 s, iOS 10.0.2.
Thank you!
What kind of "reboot", you have? What was this - restart your iPhone, iPad or iPod touch - Apple Support? If you did, and it did not work, try switching iCloud drive, power switch (settings > iCloud > iCloud drive). If this does not work, try to connect to your iCloud account and reconnect.
-
I know, I have to connect to the internet to validate my monthly subscription to Photoshop CC. What happens if I can not connect to the internet for more than 30 days? It will be expired immediately, or changes in the first instance, or there is a period of grace for this?
you will not be able to open ps after 30 days.
(on the other hand, if it is already open on the 30th day and you leave it open, it must continue to operate unless you shut up.)
-
What query can we use... .for more than 30 days
Select the PROPERTY, RELAVANTDATE,
Sum (records) more)
partition of property
order of RELAVANTDATE
between the '30' day interval preceding and the current line
) "SUM".
of Test_Data
What query can we use... .for more than 30 days
can I use following or precedingSCOTT@soti_9> WITH Test_Data AS ( 2 select 10100 as property, to_date('25-JAN-07') as RelavantDate, 20 as notices from dual union all 3 select 10100 as property, to_date('25-DEC-07') as RelavantDate, 5 as notices from dual union all 4 select 10100 as property, to_date('02-JAN-08') as RelavantDate, 10 as notices from dual union all 5 select 10100 as property, to_date('01-DEC-08') as RelavantDate, 10 as notices from dual union all 6 select 10100 as property, to_date('02-DEC-08') as RelavantDate, 20 as notices from dual union all 7 select 10100 as property, to_date('31-DEC-08') as RelavantDate, 20 as notices from dual union all 8 select 10100 as property, to_date('03-JAN-09') as RelavantDate, 30 as notices from dual union all 9 select 10100 as property, to_date('25-JAN-09') as RelavantDate, 20 as notices from dual 10 ) 11 select PROPERTY,RELAVANTDATE , 12 sum(NOTICES) over ( 13 partition by property 14 order by RELAVANTDATE 15 range between current row and interval '30' day following 16 ) "SUM" 17 from Test_Data 18 ; PROPERTY RELAVANTD SUM ---------- --------- ---------- 10100 25-jan-07 20 10100 25-dec-07 15 10100 02-jan-08 10 10100 01-dec-08 50 10100 02-dec-08 40 10100 31-dec-08 70 10100 03-jan-09 50 10100 25-jan-09 20 8 rows selected.
Kind regards
Dima -
Script to rename the virtual computer by name DNS listed in VC
I am very new to powershell, and I tried to understand this by using pieces of code I found, but nothing helped.
I'm looking for a script to take the given DNS host name for a virtual machine listed in VCenter and rename the virtual computer.
For example.
Host01VM01 (as shown in Vcenter) - the DNS name of the "something.xyz.com". VM and rename it "something.xyz.com" in Vcenter.
To run the script only for a group called "Mycluster" you can do:
Get-Cluster "My Cluster" | Get-VM | ` Where-Object { $_.Guest.HostName } | ` ForEach-Object { Set-VM -VM $_ -Name $_.Guest.HostName -Confirm:$false }
This script will only work for VMS that have installed VMware tools and probably only for VM which are turned on.
-
repeating subforms can you script to stop the same value being selected more than once
I have a LiveCycle form with a subform that is repeated when the first field (text field 2 characters) requires the entry of a code between 01 and 99. You can script so that you cannot enter the same value of code more than once?
Here's a code in Formcalc that works for you. Put it in the output of the textfield event.
In this example, the page is called myPage and textField is called TextField1. Rename them as you need.
indexCount var = 0
var thisIndex = $. parent.index
While (indexCount< thisindex)="">
If (myPage [indexCount]. TextField1 is myPage [thisIndex]. TextField1) then
xfa.host.messageBox ("you already used this number")
$ = ""
endif
indexCount = indexCount + 1
endwhile
-
Script to add the virtual computer to the inventory of different data warehouses
I need a script that will go through all available databases and add the virtual machine inside of them in inventory.
I know how to do this with:
New-VM - VMFilePath ' [DATASTORE] vmfolder/vmname.vmx "-VMHost (Get-Cluster"NOMCLUSTER"|) Get-VMHost | Get - Random) - place (Get-folder folder_name) - RunAsync
But we have hundreds of data stores and thousands of virtual machines. I suck at writing scripts in a loop, but it looks like that's what I need. I tried using wildcards for the VMFilePath - but it does not work. Must be another way.
Any help would be greatly appreciated!
Oh, I fixed it. I had a host that was plundered with partial connectivity to storage. The script was repeatedly tries to connect to this host jacked up.
I managed to work around the problem by changing "Get-VMHost | Select - first 1 "to" Get-VMHost | Get-Random.
Works fine now... as do all things Luke and Lam
-
I received my phone Friday and noticed shortly after opening the package that there is a crack in the bottom right of the laptop cover. The bottom of the laptop is now separating it from the case.
I spent more than two hours on hold trying to request a RMA. This is unacceptable.
I want a full refund, that this failure to Lenovo may have been spotted before it was delivered to me.
My customer information are below. Please contact me to correct this situation.
Order number: 4288307601
number of cases: 8000174706
Note of the moderator; personal information under the protection of its own branch
Hey elhortez,
Working to get support for you to get the process of refund for you. I'll follow to the top as soon as I can with confirmation.
Thank you
Ty
-
How to increase the time-out value for more than 15 seconds?
Find a web page expires at 15 seconds. I want to set the timeout for a longer period of time. I don't find a place to do this in the Options. When I go to full pages, I want to continue to try more rather than keep hitting the Try Again button.
The parameter for which is not in Firefox, it must be changed in Windows.
http://drewthaler.blogspot.com/2005/09/changing-DNS-query-timeout-in-Windows.html
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DNSQueryTimeouts
Multiple string: '0 1 2 2 4 8'-> "4 8 8 16 32 0". -
At one point he recorded for the month, but I did sort of a security update and now my history is deleted like every two days. Is it possible to set up the number of days or months or something, while Firefox keeps my browsing history for a longer period of time? (I have 8.1 of Windows and 37.0.2 Firefox if that helps with anything.)
Maybe the feature is removed in newer versions. But there is an add-on that allows you to set your preferred dates custom to make FF clear your history and other data. Give him a look at: https://addons.mozilla.org/en-US/firefox/addon/precise-clear-history/
Thank you
Maybe you are looking for
-
Satellite M30X-161: Pro House
Dear gentlemen/ladies, I just bought a laptop Satellite M30X-161 (yesterday). The installed operating system's default Windows XP Home Edition.Now I have 2 questions:(1) do I need a Windows XP Service Pack?(2) I have Windows XP Professional too. Is i
-
Users of accounts Hotmail does not invite E-mail
Hi, I use the Netgear 204 system everything works fine. 6.3.5 software Although I would fix ReadyCloud access to family records. Everyone that I invite you has a hotmail.com address does not invite him. Anyone who has a work related e-mail gets the i
-
Can I share pictures and videos via Bluetooth to an android device?
mini iPad - 12.7 GB capacity I can't find a Bluetooth icon when I click the button share. And I can't share a photo from an even android device with a paired device. It is a problem for Apple in Myanmar because the internet connection is not very goo
-
for some reason any when I connect it says blocking down but it dose not after an hour I would push the bar on or pull off the Gack DC it's been driving me crazy
-
This format of brush is not supported with photoshop
So, yesterday I downloaded the application brush of Adobe and had fun by making a few brushes last night that were available in Photoshop. Today, I did a load more and also updated my Photoshop CC 2015... now brushes are not recognized as a format su