This topic contains 10 replies, has 3 voices, and was last updated by
March 10, 2015 at 4:35 pm #23214
a powershell script (code) works in win server 2008 but same code does not work in 2012, why?
March 10, 2015 at 4:42 pm #23215
You will have to be a LOT more specific. What code? Error messages?
March 10, 2015 at 11:23 pm #23223
A powershell code "Get-RemoteEventLogs" for windows server 2008. why does not work in windows server 2012
March 11, 2015 at 4:44 am #23227ParticipantTopics: 4Replies: 18Points: 0Rank: Member
Is the target the same on both? Is winrm enabled? Firewall blocking?
March 11, 2015 at 5:58 am #23237
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.
March 12, 2015 at 7:25 am #23270
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.
March 12, 2015 at 7:27 am #23272
here is error message when I tried to run eventlog code
March 12, 2015 at 7:30 am #23274
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.
March 12, 2015 at 7:40 am #23276
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?
March 13, 2015 at 11:04 am #23332
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.
March 13, 2015 at 11:12 am #23333
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.
The topic ‘win server 2008 and 2012’ is closed to new replies.