You will have to connect to the remote server specifying 'explicit
credentials' of an administrator on this remote server. The way you are
doing, is using (through impersonation) the 'current' user's credentials to
create shares on a remote server which is obviously not allowed.
Search the docs for the ConnectionOptions class and it's UserName, Password
and Impersonation properties.
Willy.
[quoted text, click to view] "Brian Hampson" <brian.hampson@gmail.com> wrote in message
news:1153168265.112787.83640@h48g2000cwc.googlegroups.com...
|I am trying to create a tool for new user creation so that our Help
| Desks can create users, home directories, the shares, and add them to
| groups.
|
| It was all good until I got to creating shares on the servers (some are
| DC's) I can't find ANY WAY to get around the following (in C#):
|
| System.Management.ManagementClass mc = new
| System.Management.ManagementClass("\\\\" + oHomeServer.Text.Trim() +
| "\\root\\cimv2", "Win32_Share", null);
| System.Management.ManagementBaseObject inParams =
| mc.GetMethodParameters("Create");
|
| I get "Access Denied" exception when I run this as a NON-Admin user in
| the HelpDesk Group. I have given ALL rights to the WMI services to the
| "HelpDesk Group" on server which I am creating the share. It won't let
| me :(
|
| ***
| When I log into a PC as that user, and run through computer
| managemenet/attach to server and then go through "Create a new share",
| it all works great... Directory is created, share is created etc. This
| would indicate to me that the user has rights to do this, but that the
| code being called by the tool is different than the code that _I_ am
| calling :(
| ***
| What rights do I need for the HelpDesk Group on what aspects of what
| object for this to work? What code should I call instead? I have
| brick shaped dent in my forehead from this problem, and the balding
| patch is growing larger from pullling all my hair out!!!!
|
| So, all you WMI and security gurus out there... help please.
|
| Thanks,
|
| Brian Hampson
| System Administrator - North America
| ALS Laboratory Group, Environmental Division
|