Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys,
Below command when i try on powershell version 2 works well but the same doesnt works in powershell version 1.0
New-EventLog -LogName Application -Source "applicationlog"

What I have tried:

I am trying it to maniplulate this line into another way so that it can run on both powershell versions but i am missing out something i guess.

get-EventLog -LogName Application -newest "applicationlog" --- this command line fails with an error

like can any one tell me how to reach to file applicationlog kept in application folder using powershell version 1.0
Posted
Updated 24-Mar-16 13:47pm
Comments
Patrice T 24-Mar-16 19:43pm    
Upgrade to last PowerShell

First of all... Error messages are often quite informational. Supplying that error message is a good (no, really... it's mandatory) idea when you're asking questions about your problem on any forum.

Anywho, you're talking about two completely different commands. New-EventLog and Get-EventLog. For the latter, the parameter -Newest expects an integer and not a string. "applicationlog" is a string.

And finally, PowerShell 1.. really? What, where, when, how, why? :)
 
Share this answer
 
New versions of PowerShell habe more features than previous ones.
Upgrade to last PowerShell !
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900