Hi,
I have a problem with a Windows Service that I have created accessing
System.Manageme nt.dll on a W2k3 environment. The Service runs fine on
an XP machine but the same Service causes an error once it tries to
access System.Manageme nt.Dll. The service is run using a Domain Admin
acoount.
The code is trying to set permissions for a file and looks like this:
Dim objFile As New ManagementObjec t(New
ManagementPath( "Win32_Logicalf ileSecuritySett ing='" + _
FolderPath.Repl ace("\", "\\") + "'"))
Dim options As New InvokeMethodOpt ions(Nothing, New TimeSpan(0, 0, 0,
5))
Dim outparams As ManagementBaseO bject =
objFile.InvokeM ethod("GetSecur ityDescriptor", Nothing, options)
It is the last line where the following error happens:
"MESSAGE: Not found
STACK TRACE: at System.Manageme nt.ManagementEx ception.ThrowWi thExtendedInfo( ManagementStatu s
errorCode)
at System.Manageme nt.ManagementOb ject.InvokeMeth od(String
methodName, ManagementBaseO bject inParameters, InvokeMethodOpt ions
options)
at Permissions_Ser vice.MgmtModule .AddRoleToFolde r(String
FolderPath, String[] SIDsToAdd)"
I added a strong name to the Service and added the approriate
permissions using the Runtime Security Policy tool. Then I got the
same error when I run the service on XP as I did with W2K3.
I would really appreciate any help on this.
Thank in advance.
Ger.
I have a problem with a Windows Service that I have created accessing
System.Manageme nt.dll on a W2k3 environment. The Service runs fine on
an XP machine but the same Service causes an error once it tries to
access System.Manageme nt.Dll. The service is run using a Domain Admin
acoount.
The code is trying to set permissions for a file and looks like this:
Dim objFile As New ManagementObjec t(New
ManagementPath( "Win32_Logicalf ileSecuritySett ing='" + _
FolderPath.Repl ace("\", "\\") + "'"))
Dim options As New InvokeMethodOpt ions(Nothing, New TimeSpan(0, 0, 0,
5))
Dim outparams As ManagementBaseO bject =
objFile.InvokeM ethod("GetSecur ityDescriptor", Nothing, options)
It is the last line where the following error happens:
"MESSAGE: Not found
STACK TRACE: at System.Manageme nt.ManagementEx ception.ThrowWi thExtendedInfo( ManagementStatu s
errorCode)
at System.Manageme nt.ManagementOb ject.InvokeMeth od(String
methodName, ManagementBaseO bject inParameters, InvokeMethodOpt ions
options)
at Permissions_Ser vice.MgmtModule .AddRoleToFolde r(String
FolderPath, String[] SIDsToAdd)"
I added a strong name to the Service and added the approriate
permissions using the Runtime Security Policy tool. Then I got the
same error when I run the service on XP as I did with W2K3.
I would really appreciate any help on this.
Thank in advance.
Ger.