Report that will tell him which machines were restarted after the solidcore installation

Hi ,

Is there any way we can run a script to find out which machines were restarted after the solidcore installation I have a list of 110 windows servers?
Please suggest!
Techie solutionVMware SpecialistAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
You will need to reference the Event Log, to figure out if this machines has rebooted. You will also need to reference the event log as well for a specific log stating that this software has been installed.

How are you installing this software on these servers? using grop policy?

Will.
0
Techie solutionVMware SpecialistAuthor Commented:
HI Will,

I was wondering if there is any script which can run the report for all machine which is rebooted. I have 110 servers and want to monitor their rebbot after software deployment.
0
Will SzymkowskiSenior Solution ArchitectCommented:
You could try something like the script below...
$computers = get-content "C:\computers.txt"
ForEach ($comp in $computers) 

        {
            Try {
         
            $LOGS = Get-EventLog -LogName System -ComputerName $comp | ? { $_.EventID -eq "1047" } -ErrorAction stop

        } catch {

            $NotFound = "notfound"

        }

            If ($NotFound) 

                {

                Write-Output "$comp has not been rebooted"

        } else {

                Write-Warning "$comp has been rebooted"

        }


}

Open in new window


Will.
0
Hey MSSPs! What's your total cost of ownership?

WEBINAR: Managed security service providers often deploy & manage products from a variety of solution vendors. But is this really the best approach when it comes to saving time AND money? Join us on Aug. 15th to learn how you can improve your total cost of ownership today!

Techie solutionVMware SpecialistAuthor Commented:
Hi Will,

Don't we need to define the strings which you have used also what about the output. I need the output on any file like .xlxs or .txt.

Moreover I think its a vbscript is there any way I can get same in powershell too?

Thank You!
0
Will SzymkowskiSenior Solution ArchitectCommented:
The script I have provided is in fact a powershell script. I have tested the one above and it does not work exactly how i'd like it to. Below I have re-constructed what you are looking for.

The Event ID for a reboot is 1074.

$computers = get-content "C:\computers.txt"
$EventNumber = "1074"
ForEach ($comp in $computers) 

    {

        $FindEvent = Get-EventLog -LogName system | ? { $_.EventID -eq "$EventNumber" }
        
        if ($FindEvent.EventID -eq $null)
                {

                Write-Output "$comp has not been rebooted" | Out-File "c:\testexport.csv" -Append

      } else {

                Write-Warning "$comp has been rebooted" | Out-File "c:\testexport.csv" -Append

      }


}

Open in new window


This will write out all of the server status based on the event 1074 in the logs, for each machine.

I have just tested this and it is working correctly.

Will.
0
Techie solutionVMware SpecialistAuthor Commented:
Thank You Will.
Also do we need to run this script in our Domain controllers or Local system will work, Also do we need to import active directory module before running this?
0
Will SzymkowskiSenior Solution ArchitectCommented:
No activedirectory module required as i am using get-eventlog cmdlet which is native to the powershell interface.

You can run this on a local machine with an account that has admin rights on the servers you are querying against.

Will.
0
Techie solutionVMware SpecialistAuthor Commented:
HI Will ,

This way we can get to know if the servers were rebooted or not. Is there any way we can get the last time when server was rebooted ?

Thank You!
0
Will SzymkowskiSenior Solution ArchitectCommented:
Should be do-able. I will see what I can do.

Will.
0
Techie solutionVMware SpecialistAuthor Commented:
Thank You Will again.. :)
0
Will SzymkowskiSenior Solution ArchitectCommented:
I have added a couple of things and it now exports the time as well.

$computers = get-content "C:\computers.txt"
$EventNumber = "1074"
ForEach ($comp in $computers) 

      {

            $FindEvent = Get-EventLog -LogName system -ComputerName $comp | ? { $_.EventID -eq "$EventNumber" }
            $Time = $FindEvent.TimeGenerated | Out-String

      
            if ($FindEvent.EventID -eq $null)
                    {

                    Write-Output "$comp has not been rebooted" | Out-File "c:\testexport.csv" -Append

          } else {

                    Write-Output "$comp has been rebooted at $Time" | Out-File "c:\testexport.csv" -Append

          }


}

Open in new window


Will.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.