Win32_NTEventLogFile BackupEventLog: Access denied

M

Maximilian Hänel

I have some trouble calling BackupEventlog. Even if I'm logged on as an
Administrator I get an access denied error:

PS H:\> $log=gwmi "Win32_NTEventLogFile WHERE LogFileName='Application'"
PS H:\> $log.BackupEventlog("C:\Test.evt")
Ausnahme beim Aufrufen von "BackupEventlog": "Zugriff verweigert. "
Bei Zeile:1 Zeichen:20
+ $log.BackupEventlog( <<<< "C:\Test.evt")

The scripts found on the internet are using something like this when
binding to wmi:

"{impersonationLevel=impersonate,(Backup)}!\\"

How can this be done in PS?

tia

Max
 

My Computer

B

Brian McDermott

Stick this line in the mddle.

$log.PSBase.Scope.Options.EnablePrivileges = $true

For more info see

http://mow001.blogspot.com/2006/10/powershell-wmi-support-in-rc2.html

BrianMcD


"Maximilian Hänel" <[email protected]> wrote in message
news:[email protected]
>I have some trouble calling BackupEventlog. Even if I'm logged on as an
>Administrator I get an access denied error:
>
> PS H:\> $log=gwmi "Win32_NTEventLogFile WHERE LogFileName='Application'"
> PS H:\> $log.BackupEventlog("C:\Test.evt")
> Ausnahme beim Aufrufen von "BackupEventlog": "Zugriff verweigert. "
> Bei Zeile:1 Zeichen:20
> + $log.BackupEventlog( <<<< "C:\Test.evt")
>
> The scripts found on the internet are using something like this when
> binding to wmi:
>
> "{impersonationLevel=impersonate,(Backup)}!\\"
>
> How can this be done in PS?
>
> tia
>
> Max
 

My Computer

M

Maximilian Hänel

Hi Brian,

> Stick this line in the mddle.
>
> $log.PSBase.Scope.Options.EnablePrivileges = $true


Thanks a lot!!!

cu

Max
 

My Computer

Top