a powershell script (code) works in win server 2008 but same code does not work in 2012, why?
You will have to be a LOT more specific. What code? Error messages?
A powershell code “Get-RemoteEventLogs” for windows server 2008. why does not work in windows server 2012
Is the target the same on both? Is winrm enabled? Firewall blocking?
Get-RemoteEventLogs is not a native PowerShell command. If it isn’t installed on the other server, then PowerShell can’t run it.
You can’t upload .ps1 files here. You will need to rename it to .txt if you want to upload it.
I have attach powershell code and error message. I wanto be clear that code will make this file “_security.txt” or we have to first make and save “_security.txt” file in the computer somewhere. plz give the all steps which need to monitor eventlog and alert administrator via email.
here is error message when I tried to run eventlog code
So, let’s just set some expectations: We’re all volunteers here, and we’re not here to give you all steps or to write code for you. We’re happy to help with something you’re stuck on, but we’re not a free consulting service.
Unfortunately, your error message did not upload. You’re welcome to just paste the text of the error message into a reply.
Your script is designed to run against a local computer. If you have Remoting enabled on your computers (supported in PowerShell v2 or later), you can use Remoting to deploy the script. For example, if the script is called c:\eventlog.ps1:
Invoke-Command -File c:\eventlog.ps1 -ComputerName ONE,TWO,THREE
That would run the script on computers named ONE, TWO, and THREE. They would each create the CSV file on their local file system. This does assume that Remoting is enabled on ONE, TWO, and THREE.
If you need to send an e-mail, look at the Send-MailMessage command.
This line is the error:
$fname = $date.Year.ToSingle() + “0” +
Because that fails, $fname is empty. That’s why you’re getting an error on the three -Path parameters of Get-EventLog.
$date is a DateTime object; it has a property, Year. You’ve got that correct. The Year property is an Int32. Int32 supports the ToSingle() method, but you’re not using it correctly. Do you NEED to use ToSingle()? I’m not sure what the goal is, there. Year is already an integer; the year will always be a whole number and never a floating point, so I’m not sure why you’re using ToSingle. Can you help me understand the purpose?
I have windows server 2012 and windows 8.1 and I want to develop IDS (intrusion detection system) using windows powershell. I mean central eventlog monitoring and alerting to administrator. I need code which can monitor eveentlog on local machine and remote machine.
I truly don’t think PowerShell is the right tool in which to build an IDS. You’re looking at a level of performance that PowerShell simply is not meant to provide.