Pages: [1]
Print
Author Topic: verify ntpclient service on your esx hosts  (Read 1663 times)
esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: August 03, 2009, 12:07:30 PM »

Code:
foreach ($vmhost in get-vmhost) {
$fw = $vmhost | get-VMHostFirewallException | where {$_.name -eq "NTP Client" -and $_.Enabled -eq "true" -and $_.ServiceRunning -eq "true"}
"" | select  @{Name = "Host"; Expression = {$vmhost.name}}, @{Name = "NTP Running ports"; Expression = {$fw.name}}
}
« Last Edit: August 12, 2009, 07:51:49 AM by esarakaitis » Logged
jsingh
Newbie
*
Posts: 7


View Profile WWW
« Reply #1 on: August 12, 2009, 07:44:51 AM »

hi,

this script does not work for me.

3.5U4, VI 2.5U5, powercli 4.0, powershell 1.0

thanks,

jason
Logged

esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #2 on: August 12, 2009, 07:45:09 AM »

is there an error?
Logged
esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #3 on: August 12, 2009, 07:51:57 AM »

found my typo, try it now
Logged
jsingh
Newbie
*
Posts: 7


View Profile WWW
« Reply #4 on: August 12, 2009, 07:52:46 AM »

Code:
The term './verifyntp.ps1' is not recognized as a cmdlet, function, operable program, or script file. Verify the term a
nd try again.
At line:1 char:15
+ ./verifyntp.ps1 <<<<

verifyntp.ps1 is the name of the file which contains your code above.

Logged

jsingh
Newbie
*
Posts: 7


View Profile WWW
« Reply #5 on: August 12, 2009, 07:56:04 AM »

found my typo, try it now

works now! I guess we can specify any name in there? Example Dell Mgt etc.?
Logged

jsingh
Newbie
*
Posts: 7


View Profile WWW
« Reply #6 on: August 12, 2009, 08:03:55 AM »

In case anyone wants to convert to html:

Code:
$ntprun = @()
foreach ($vmhost in get-vmhost) {
$fw = $vmhost | get-VMHostFirewallException | where {$_.name -eq "NTP Client" -and $_.Enabled -eq "true" -and $_.ServiceRunning -eq "true"}
$row = "" | select  @{Name = "Host"; Expression = {$vmhost.name}}, @{Name = "NTP Running ports"; Expression = {$fw.name}}
$ntprun +=$row
}
$ntprun | ConvertTo-Html | Out-File test.htm
Logged

Pages: [1]
Print
Jump to: