----- Original Message -----
From: ""Jeffrey Tan[MSFT]"" <(E-Mail Removed)>
Newsgroups: microsoft.public.dotnet.languages.vb
Sent: Monday, April 30, 2007 10:06 PM
Subject: Re: Finding a share's directory spec
> Ok, if you still need any help or have any concern, please feel free to
> tell me, thanks.
You shouldn't have asked...
I used the following code:
Dim VPHOMEpath As String = ""
Dim objClass As New Management.ManagementClass("Win32_Share")
Dim objShare As Management.ManagementObject
For Each objShare In objClass.GetInstances()
If objShare.Properties("Name").Value = "VPHOME" Then
VPHOMEpath = objShare.Properties("Path").Value
End If
Next objShare
Now, if I use it in a standard vb.net app and run it, VPHOMEpath gets the
proper path returned and everything runs fine. If I take the exact same code
and paste it into another project that's running as a service, the wheels
fly off the wagon. Apparently, objShare.Properties("Path").Value returns a
null value when running as a service.
Now, the only difference I can think of is that the standard app is running
under my credentials and the service is running on the local service
account. I would prefer not to run it under a userID if I can avoid it...
Does anyone have any thoughts?
Thank you.