Kaseya Community

Simple procedure to map a drive

This question is not answered

Hi! I'm new to this and am trying to push through the most basic stuff. If I'm posting in the wrong spot, please forgive.

I have a Windows 2008 Server 64-bit, and about 20 Win7 Pro 64-bit machines.

I'm trying to create an agent procedure that maps G:\ to \\drobo\GlobalDocs for all computers.

My command line works from a command prompt: net use g: \\drobo\GlobalDocs

But when I plug that into an agent procedure, it just hangs in yellow highlight at the 'scheduled execution' time and never does anything.

Here is the agent procedure: 

executeShellCommand("net use g: \\drobo\GlobalDocs", "Execute as User", "All Operating Systems", "Halt on Fail"

I've tried several variations, including username/password, but since it works in this syntax from the command prompt, am assuming I should have to include that info in the agent procedure.

Where am I going wrong? Thank you for any help!

All Replies
  • Hi DaveD

    You probably know that a mapped drives are only available to the account that maps it.  Which username are you trying to map the drive for?  You have 3 choices when executing commands from a procedure:

    1) Execute as system (I recall that the system account can access the network? so probably can't map drives)

    2) Execute as (the logged in) User (of course the user needs to be logged in)

    3) Use Credential, followed by Execute as User which executes using the credential you have specified in Kaseya.

    Since the procedure is hanging, the command line is probably generating a user prompt and - because there is no one there to respond - it just sits there until the procedure times out. You will need to cancel the hung procedure and restart the Kaseya agent on the endpoint to clear your queue of "yellow" tasks.

    A couple of other debugging suggestions:

    1) You might need quotes around your path:

    e.g. net user "g:\\drobo\GlobalDocs"

    2) You might need to specify credentials to map the drive:

    e.g. net use s: g:\\drobo\GlobalDocs /user yourusername yourpassword

    Andy

  • I'm sure there are others more expert in this than I am, but right from the start I can say this is probably a matter of credentials. And you're running into two different barriers.

    First, Kaseya procedure steps are generally run by the System, or by the administrator account entered in the credentials for that machine (in Agent > Set Credential). Any drive mapping you're able to do, will only show up for either of these profiles, and not for any other human users of the system. (You can use the impersonateUser command in a Kaseya procedure to emulate another human user, though.)

    Second, since you're connecting with a network server you must pass valid credentials to it in the command. MS has an article on "net use" that shows how (technet.microsoft.com/.../bb490717.aspx). In your case it should be:

    net use g: \\drobo\GlobalDocs /user:serverusername serverpassword

    If memory serves; it's been a while since I did this. To make it persistent use the /persistent:yes switch, and if you do, you'll probably also want those server credentials saved, so use the /savecred switch.

  • If you have the desktop management module you can create a rule for the mapped drive and not bother with a procedure.