VB.Net WMI Windows Server 2003

  • Thread starter Thread starter Ger
  • Start date Start date
G

Ger

I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted on a
local machine or somewhere on the network. I use the Management Base
Object to set these permissions which works perfectly when the windows
service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable would also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
If the code works as expected in XP it should behave correctly in w2k3 also
.. Please make sure the fileobject on which you are trying to invoke the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros with a normal
exe.

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
 
Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

Sarika Sharma said:
If the code works as expected in XP it should behave correctly in w2k3 also
. Please make sure the fileobject on which you are trying to invoke the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros with a normal
exe.

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted on a
local machine or somewhere on the network. I use the Management Base
Object to set these permissions which works perfectly when the windows
service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable would also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
If the code works as expected in XP it should behave correctly in w2k3 also
. Please make sure the fileobject on which you are trying to invoke the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros with a normal
exe.

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted on a
local machine or somewhere on the network. I use the Management Base
Object to set these permissions which works perfectly when the windows
service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable would also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
The exact error code I get is "NotFound"! My service is running as a
Domian Admin account.

Could it be anything to do with policies?

Appreciate the help.

Ger.


Sarika Sharma said:
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
If the code works as expected in XP it should behave correctly in w2k3 also
. Please make sure the fileobject on which you are trying to invoke the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros with a normal
exe.

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted on a
local machine or somewhere on the network. I use the Management Base
Object to set these permissions which works perfectly when the windows
service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable would also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
The domain admin account should be able to perform this action.

NotFound management exception indicates that the management object you are
trying to work with does not exist. which is not explaining well as with
normal exe you are able to .

Did you run normal exe under domain admin as well?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
The exact error code I get is "NotFound"! My service is running as a
Domian Admin account.

Could it be anything to do with policies?

Appreciate the help.

Ger.


"Sarika Sharma[MSFT]" <[email protected]> wrote in message
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
If the code works as expected in XP it should behave correctly in
w2k3
also
. Please make sure the fileobject on which you are trying to invoke the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros with a normal
exe.

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted on a
local machine or somewhere on the network. I use the Management Base
Object to set these permissions which works perfectly when the
windows
service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable would also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
Yes it does seem like the service is having problems finding the
management object but this is strange as I run the normal exe under
Domain Admin too. I will check if I can use the WMI object directly
instead of using the managemnet object to see if this may help.

Thanks.

Ger.

Sarika Sharma said:
The domain admin account should be able to perform this action.

NotFound management exception indicates that the management object you are
trying to work with does not exist. which is not explaining well as with
normal exe you are able to .

Did you run normal exe under domain admin as well?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
The exact error code I get is "NotFound"! My service is running as a
Domian Admin account.

Could it be anything to do with policies?

Appreciate the help.

Ger.


"Sarika Sharma[MSFT]" <[email protected]> wrote in message
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
If the code works as expected in XP it should behave correctly in
w2k3
also
. Please make sure the fileobject on which you are trying to invoke the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros with a normal
exe.

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted on a
local machine or somewhere on the network. I use the Management Base
Object to set these permissions which works perfectly when the
windows
service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable would also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
Hello Again,

I have pulled out as much error information that I can get. Maybe this
may help to solve the problem.

MESSAGE: Not found

STACK TRACE:
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus
errorCode)
at System.Management.ManagementObject.InvokeMethod(String
methodName, ManagementBaseObject inParameters, InvokeMethodOptions
options)
at Permissions_Service.MgmtModule.AddRoleToFolder(String
FolderPath, String[] SIDsToAdd)

ERROR CODE:-2147217406

ERROR INFORMATION:
{System.Management.ManagementBaseObject}
ClassPath: {System.Management.ManagementPath}
Container: Nothing
Item: <cannot view indexed property>
Properties: {System.Management.PropertyDataCollection}
Qualifiers: {System.Management.QualifierDataCollection}
Site: Nothing
SystemProperties: {System.Management.PropertyDataCollection}

GET TYPE:
[System.RuntimeType]: {System.RuntimeType}
Assembly: {System.Reflection.Assembly}
AssemblyQualifiedName: "System.Management.ManagementException,
System.Management, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
Attributes: 1056769
BaseType: {System.RuntimeType}
DeclaringType: Nothing
DefaultBinder: {System.DefaultBinder}
Delimiter: "."c
EmptyTypes: {Length=0}
FilterAttribute: {System.Reflection.MemberFilter}
FilterName: {System.Reflection.MemberFilter}
FilterNameIgnoreCase: {System.Reflection.MemberFilter}
FullName: "System.Management.ManagementException"
GUID: {System.Guid}
HasElementType: False
IsAbstract: False
IsAnsiClass: True
IsArray: False
IsAutoClass: False
IsAutoLayout: True
IsByRef: False
IsClass: True
IsCOMObject: False
IsContextful: False
IsEnum: False
IsExplicitLayout: False
IsImport: False
IsInterface: False
IsLayoutSequential: False
IsMarshalByRef: False
IsNestedAssembly: False
IsNestedFamANDAssem: False
IsNestedFamily: False
IsNestedFamORAssem: False
IsNestedPrivate: False
IsNestedPublic: False
IsNotPublic: False
IsPointer: False
IsPrimitive: False
IsPublic: True
IsSealed: False
IsSerializable: True
IsSpecialName: False
IsUnicodeClass: False
IsValueType: False
MemberType: TypeInfo
Missing: {System.Reflection.Missing}
Module: {System.Reflection.Module}
Name: "ManagementException"
Namespace: "System.Management"
ReflectedType: Nothing
TypeHandle: {System.RuntimeTypeHandle}
TypeInitializer: Nothing
UnderlyingSystemType: {System.RuntimeType}

TARGIT SITE:
{System.Reflection.RuntimeMethodInfo}
[System.Reflection.RuntimeMethodInfo]:
{System.Reflection.RuntimeMethodInfo}
Attributes: 147
CallingConvention: Standard
DeclaringType: {System.RuntimeType}
IsAbstract: False
IsAssembly: True
IsConstructor: False
IsFamily: False
IsFamilyAndAssembly: False
IsFamilyOrAssembly: False
IsFinal: False
IsHideBySig: True
IsPrivate: False
IsPublic: False
IsSpecialName: False
IsStatic: True
IsVirtual: False
MemberType: Method
MethodHandle: {System.RuntimeMethodHandle}
Name: "ThrowWithExtendedInfo"
ReflectedType: {System.RuntimeType}


Kind Regards,

Ger.
Yes it does seem like the service is having problems finding the
management object but this is strange as I run the normal exe under
Domain Admin too. I will check if I can use the WMI object directly
instead of using the managemnet object to see if this may help.

Thanks.

Ger.

Sarika Sharma said:
The domain admin account should be able to perform this action.

NotFound management exception indicates that the management object you are
trying to work with does not exist. which is not explaining well as with
normal exe you are able to .

Did you run normal exe under domain admin as well?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
The exact error code I get is "NotFound"! My service is running as a
Domian Admin account.

Could it be anything to do with policies?

Appreciate the help.

Ger.


"Sarika Sharma[MSFT]" <[email protected]> wrote in message
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
If the code works as expected in XP it should behave correctly in w2k3
also
. Please make sure the fileobject on which you are trying to invoke the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros with a normal
exe.

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted on a
local machine or somewhere on the network. I use the Management Base
Object to set these permissions which works perfectly when the windows

service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable would also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
I'm going to take an educated guess here and suggest that its a OS path
error.

If you developed the app on a XP machine, then the physical path to the
OS in your program would read, for example:

C:\Windows

instead of

C:\WINNT

For the Y2k3

I think! Since I don't have 2003 Server, I don't know if it follows the
C:\WINNT family path. But if it does, then that is the issue and the only
two ways I'm aware of to resolve the issue would to be install 2003 Server,
VB.Net on it and then compile the program with the right path.

Also, although I'm not sure if this would work--much less compile
correctly -- you may want to change:

<Reference
Name = "System.Management"
AssemblyName = "System.Management"
HintPath =
"..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Management.
dll"
/>
in your apllication .Net Project file (not the vbproj) to read

<Reference
Name = "System.Management"
AssemblyName = "System.Management"
HintPath =
"..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Management.dl
l"
/>




Ger said:
Yes it does seem like the service is having problems finding the
management object but this is strange as I run the normal exe under
Domain Admin too. I will check if I can use the WMI object directly
instead of using the managemnet object to see if this may help.

Thanks.

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
The domain admin account should be able to perform this action.

NotFound management exception indicates that the management object you are
trying to work with does not exist. which is not explaining well as with
normal exe you are able to .

Did you run normal exe under domain admin as well?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Ger said:
The exact error code I get is "NotFound"! My service is running as a
Domian Admin account.

Could it be anything to do with policies?

Appreciate the help.

Ger.


"Sarika Sharma[MSFT]" <[email protected]> wrote in message
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in
message
If the code works as expected in XP it should behave correctly
in
w2k3
also
. Please make sure the fileobject on which you are trying to
invoke
the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros
with a
normal
no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





I am having problems using VB.Net's Management base object on a
machine hosting Windows Server 2003. I am trying to set file
permissions from a Windows Service. These files may be loacted
on
a
local machine or somewhere on the network. I use the
Management
Base
Object to set these permissions which works perfectly when the windows

service is running on an XP machine. However, when the service is
running on a Windows Server 2003 machine I get an error.

When the following code is executed an exception is thrown with a
meassge of "Not Found"!

Dim outparams As ManagementBaseObject =
objFile.InvokeMethod("GetSecurityDescriptor", Nothing, options)

I am not sure if this problem is specific to running a Windows Service
on a Windows Server 2003 machine or if a normal executable
would
also
produce the same result.

Any help or suggestions would be greatly appreciated on this.

Kind Regards.

Ger.
 
We have finally figured out the prolem. The System.Management.dll on
W2k3 Server does not automatically give permissions to "Local Service"
and "Network Sewrvice" accounts. This is automatically done with XP.

Thanks to all who have provided help.

Ger.


Richard T. Edwards said:
I'm going to take an educated guess here and suggest that its a OS path
error.

If you developed the app on a XP machine, then the physical path to the
OS in your program would read, for example:

C:\Windows

instead of

C:\WINNT

For the Y2k3

I think! Since I don't have 2003 Server, I don't know if it follows the
C:\WINNT family path. But if it does, then that is the issue and the only
two ways I'm aware of to resolve the issue would to be install 2003 Server,
VB.Net on it and then compile the program with the right path.

Also, although I'm not sure if this would work--much less compile
correctly -- you may want to change:

<Reference
Name = "System.Management"
AssemblyName = "System.Management"
HintPath =
"..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Management.
dll"
/>
in your apllication .Net Project file (not the vbproj) to read

<Reference
Name = "System.Management"
AssemblyName = "System.Management"
HintPath =
"..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Management.dl
l"
/>




Ger said:
Yes it does seem like the service is having problems finding the
management object but this is strange as I run the normal exe under
Domain Admin too. I will check if I can use the WMI object directly
instead of using the managemnet object to see if this may help.

Thanks.

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
The domain admin account should be able to perform this action.

NotFound management exception indicates that the management object you are
trying to work with does not exist. which is not explaining well as with
normal exe you are able to .

Did you run normal exe under domain admin as well?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





The exact error code I get is "NotFound"! My service is running as a
Domian Admin account.

Could it be anything to do with policies?

Appreciate the help.

Ger.


"Sarika Sharma[MSFT]" <[email protected]> wrote in message
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in
message
If the code works as expected in XP it should behave correctly in
w2k3
also
. Please make sure the fileobject on which you are trying to
invoke
the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros
with a
normal
no
rights. on
a Management
Base would
also
 
We have finally managed to figure out the problem.
System.Management.dll does not have permission to the "Local Service"
and "Network Service" accounts automatically in W2k3 Server, but it
does in XP. Once I added these accounts my code runs fine.

Thanks to all who provided help.

Ger.


Richard T. Edwards said:
I'm going to take an educated guess here and suggest that its a OS path
error.

If you developed the app on a XP machine, then the physical path to the
OS in your program would read, for example:

C:\Windows

instead of

C:\WINNT

For the Y2k3

I think! Since I don't have 2003 Server, I don't know if it follows the
C:\WINNT family path. But if it does, then that is the issue and the only
two ways I'm aware of to resolve the issue would to be install 2003 Server,
VB.Net on it and then compile the program with the right path.

Also, although I'm not sure if this would work--much less compile
correctly -- you may want to change:

<Reference
Name = "System.Management"
AssemblyName = "System.Management"
HintPath =
"..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Management.
dll"
/>
in your apllication .Net Project file (not the vbproj) to read

<Reference
Name = "System.Management"
AssemblyName = "System.Management"
HintPath =
"..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Management.dl
l"
/>




Ger said:
Yes it does seem like the service is having problems finding the
management object but this is strange as I run the normal exe under
Domain Admin too. I will check if I can use the WMI object directly
instead of using the managemnet object to see if this may help.

Thanks.

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in message
The domain admin account should be able to perform this action.

NotFound management exception indicates that the management object you are
trying to work with does not exist. which is not explaining well as with
normal exe you are able to .

Did you run normal exe under domain admin as well?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





The exact error code I get is "NotFound"! My service is running as a
Domian Admin account.

Could it be anything to do with policies?

Appreciate the help.

Ger.


"Sarika Sharma[MSFT]" <[email protected]> wrote in message
What is the exact error code you are getting?

What is your service runnning as?

--
Sarika Sharma [MSFT]
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.





Hi Sarika,

My codes works fine when I run it from a normal executable in w2k3.
The problem seems to stem from the fact the code is being executed
from a windows service. Any Ideas?

Thanks,

Ger.

"Sarika Sharma[MSFT]" <[email protected]> wrote in
message
If the code works as expected in XP it should behave correctly in
w2k3
also
. Please make sure the fileobject on which you are trying to
invoke
the
method exists in w2k3 machine.

And yes it will be worth while to see if the problem repros
with a
normal
no
rights. on
a Management
Base would
also
 
Back
Top