By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

VB.Net WMI Windows Server 2003

P: n/a
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.
Nov 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
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" <ge*******@hotmail.com> wrote in message
news:1a*************************@posting.google.co m...
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.

Nov 20 '05 #2

P: n/a
Ger
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]" <sa*****@online.microsoft.com> wrote in message news:<ut*************@TK2MSFTNGP11.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a*************************@posting.google.co m...
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.

Nov 20 '05 #3

P: n/a
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<ut*************@TK2MSFTNGP11.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a*************************@posting.google.co m...
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.

Nov 20 '05 #4

P: n/a
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[MSFT]" <sa*****@online.microsoft.com> wrote in message news:<Oh**************@TK2MSFTNGP09.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<ut*************@TK2MSFTNGP11.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a*************************@posting.google.co m...
> 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.

Nov 20 '05 #5

P: n/a
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<Oh**************@TK2MSFTNGP09.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<ut*************@TK2MSFTNGP11.phx.gbl>...
> 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" <ge*******@hotmail.com> wrote in message
> news:1a*************************@posting.google.co m...
> > 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.

Nov 20 '05 #6

P: n/a
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[MSFT]" <sa*****@online.microsoft.com> wrote in message news:<ud**************@TK2MSFTNGP10.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<Oh**************@TK2MSFTNGP09.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
> 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]" <sa*****@online.microsoft.com> wrote in message news:<ut*************@TK2MSFTNGP11.phx.gbl>... > > 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" <ge*******@hotmail.com> wrote in message
> > news:1a*************************@posting.google.co m...
> > > 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.

Nov 20 '05 #7

P: n/a
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.ThrowWithExt endedInfo(ManagementStatus
errorCode)
at System.Management.ManagementObject.InvokeMethod(St ring
methodName, ManagementBaseObject inParameters, InvokeMethodOptions
options)
at Permissions_Service.MgmtModule.AddRoleToFolder(Str ing
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.
ge*******@hotmail.com (Ger) wrote in message news:<1a**************************@posting.google. com>...
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]" <sa*****@online.microsoft.com> wrote in message news:<ud**************@TK2MSFTNGP10.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message news:<Oh**************@TK2MSFTNGP09.phx.gbl>... > 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" <ge*******@hotmail.com> wrote in message
> news:1a**************************@posting.google.c om...
> > 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]" <sa*****@online.microsoft.com> wrote in message news:<ut*************@TK2MSFTNGP11.phx.gbl>... > > > 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" <ge*******@hotmail.com> wrote in message
> > > news:1a*************************@posting.google.co m...
> > > > 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.

Nov 20 '05 #8

P: n/a
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<ud**************@TK2MSFTNGP10.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<Oh**************@TK2MSFTNGP09.phx.gbl>...
> 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" <ge*******@hotmail.com> wrote in message
> news:1a**************************@posting.google.c om...
> > 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]" <sa*****@online.microsoft.com> wrote in message
news:<ut*************@TK2MSFTNGP11.phx.gbl>...
> > > 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" <ge*******@hotmail.com> wrote in message
> > > news:1a*************************@posting.google.co m...
> > > > 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.

Nov 20 '05 #9

P: n/a
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" <re****@pwpsquared.net> wrote in message news:<10*************@corp.supernews.com>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<ud**************@TK2MSFTNGP10.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
> 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]" <sa*****@online.microsoft.com> wrote in message news:<Oh**************@TK2MSFTNGP09.phx.gbl>... > > 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" <ge*******@hotmail.com> wrote in message
> > news:1a**************************@posting.google.c om...
> > > 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]" <sa*****@online.microsoft.com> wrote in message
news:<ut*************@TK2MSFTNGP11.phx.gbl>... > > > > 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" <ge*******@hotmail.com> wrote in message
> > > > news:1a*************************@posting.google.co m...
> > > > > 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.

Nov 20 '05 #10

P: n/a
Ger
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" <re****@pwpsquared.net> wrote in message news:<10*************@corp.supernews.com>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
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]" <sa*****@online.microsoft.com> wrote in message

news:<ud**************@TK2MSFTNGP10.phx.gbl>...
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" <ge*******@hotmail.com> wrote in message
news:1a**************************@posting.google.c om...
> 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]" <sa*****@online.microsoft.com> wrote in message news:<Oh**************@TK2MSFTNGP09.phx.gbl>... > > 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" <ge*******@hotmail.com> wrote in message
> > news:1a**************************@posting.google.c om...
> > > 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]" <sa*****@online.microsoft.com> wrote in message
news:<ut*************@TK2MSFTNGP11.phx.gbl>... > > > > 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" <ge*******@hotmail.com> wrote in message
> > > > news:1a*************************@posting.google.co m...
> > > > > 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.

Nov 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.