I am new to Powershell and i want to create a script which will let me get all the system logs for my office server remotely into a text file or a file which i can open in notepad or similar text editor. Can anyone help me?
I am new to Powershell and i want to create a script which will let me get all the system logs for my office server remotely into a text file or a file which i can open in notepad or similar text editor. Can anyone help me?
You need this script :
This will log all the system logs into text variable... I'm a noob too when it comes to Powershell.. so if any error please post back...Code:PS> $syslog = get-wmiobject Win32_NTLogEvent -computername $server | where-object{$_.Logfile -match "System"}
Instead of it, i would suggest you to use a query based syntax :
As it is fast.. All the best!Code:PS> $query = "Select * from Win32_NTLogEvent Where LogFile='System' and Type='Error'" PS> $syslog = get-wmiobject -query $query -computername $server
Bookmarks