Remote PS Scripting Question/Problem

BatchPatch Forums Home Forums BatchPatch Support Forum Remote PS Scripting Question/Problem

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10028
    kscurloc
    Participant

    I was able to figure this out… here’s what I did:

    cmd.exe /c echo . | powershell.exe -ExecutionPolicy Bypass -command “wevtutil el | Foreach-Object {Write-Host “Clearing $_”; wevtutil cl “$_”}”

    #10029
    doug
    Moderator

    Glad you got it figured out. This should also work:

    powershell.exe -command "wevtutil el | Foreach-Object {Write-Host "Clearing $_"; wevtutil cl "$_"}"

    #10030
    kscurloc
    Participant

    So that’s a good question, now that you mention it. =)

    In your tutorials, it says to use the “cmd.exe /c echo . | powershell.exe -ExecutionPolicy Bypass -command”. Why is this necessary, or isn’t it?

    Thanks again… really like this tool!!!

    #10031
    doug
    Moderator

    Some things have changed since that tutorial was written. In some cases it may be necessary to use the syntax from the tutorial whereas in other cases it might not be needed anymore.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.