SK90
Enthusiast
Enthusiast

Script to fetch details

Gents, Can someone help me to build a powercli script to fetch below details of multiple windows servers at one go and export data to excel sheet containing server name, reboot, last patched please.

  • Last time rebooted
  • Last time patched
0 Kudos
2 Replies
daphnissov
Immortal
Immortal

First of all, most of that would be direct Windows PowerShell and not VMware-related. Second, what have you done yourself to work towards this goal? It's generally bad form to go to any forum and ask for bespoke code be written especially for you based on your wish list.

0 Kudos
Reaper83
Contributor
Contributor

I agree with

But never the less, let me give a hint a least, because what you want, is exactly what i scripted a year ago (and it has indeed nothing to do with PowerCLI).

Get the latest update search + install:

$Update_status=(New-Object -ComObject Microsoft.Update.AutoUpdate).results

In addition, i also parse the file "c:\windows\softwaredistribution\ReportingEvents.log"

Compute uptime of the host:

(get-date) - (gcim Win32_OperatingSystem).LastBootUpTime | new-variable uptime

$uptime.days

$uptime.hours

Now if you're familiar with PS, you could take those lines and play around in order to achieve your goal (invoke-command, etc).

Hope it helps.

0 Kudos