k00tje

I do have a script which does it .

The connection part:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Restore,Backup)}!\\" _
& strComputer & "\root\default")

' Obtain an instance of the the class
' using a key property value.
Set objShare = objWMIService.Get("AltirisVSProv")

Who knows how to translate the red part to VB.NET

So far i got this:

Dim scope As ManagementScope = New ManagementScope("\\" & ComputerName & "\root\default")

scope.Options.Impersonation = ImpersonationLevel.Impersonate

scope.Options.EnablePrivileges = True

scope.Options.Username = ImpUser

scope.Options.Password = ImpPassword

scope.Connect()

It seems that i have to use System.Management.ManagementStatus.BackupRestoreWinmgmtRunning but don't know the correct syntax.



Re: Visual Basic General Impersonating with backup/restore permissions

k00tje

Nobody