win server 2008 and 2012

This topic contains 10 replies, has 3 voices, and was last updated by Profile photo of Don Jones Don Jones 1 year, 9 months ago.

  • Author
    Posts
  • #23214
    Profile photo of Hem Thapa
    Hem Thapa
    Participant

    a powershell script (code) works in win server 2008 but same code does not work in 2012, why?

  • #23215
    Profile photo of Don Jones
    Don Jones
    Keymaster

    You will have to be a LOT more specific. What code? Error messages?

  • #23223
    Profile photo of Hem Thapa
    Hem Thapa
    Participant

    A powershell code "Get-RemoteEventLogs" for windows server 2008. why does not work in windows server 2012

  • #23227
    Profile photo of Corey Thomas
    Corey Thomas
    Participant

    Is the target the same on both? Is winrm enabled? Firewall blocking?

  • #23237
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

  • #23270
    Profile photo of Hem Thapa
    Hem Thapa
    Participant

    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.

  • #23272
    Profile photo of Hem Thapa
    Hem Thapa
    Participant

    here is error message when I tried to run eventlog code

  • #23274
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

  • #23276
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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?

  • #23332
    Profile photo of Hem Thapa
    Hem Thapa
    Participant

    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.

  • #23333
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

You must be logged in to reply to this topic.