Script to map network drive on login or startup
I need to push out a simple command something like "net use x: \\10.231.0.201\invoices" either as a .bat file or just as a command. I am trying to do it through managed installations but that seems to be the wrong place cause it's not letting me save it.
It would be icing on the cake if I could have that command run at startup AND put a shortcut to x: on the desktop.
Thank you in advance for answering a question that is probably common.
Best,
Bob W.
It would be icing on the cake if I could have that command run at startup AND put a shortcut to x: on the desktop.
Thank you in advance for answering a question that is probably common.
Best,
Bob W.
0 Comments
[ + ] Show comments
Answers (5)
Please log in to answer
Posted by:
GillySpy
13 years ago
are you wanting the agent to have access to the x: drive or the logged in user?
If it's for the agent then either a batch as an MI or a script would work but i prefer script. Don't forget the username and password on the net use command if necessary (agent runs under SYSTEM account after all)
If it's the logged in user then set this up as a script and use the run as features in a script
If it's for the agent then either a batch as an MI or a script would work but i prefer script. Don't forget the username and password on the net use command if necessary (agent runs under SYSTEM account after all)
If it's the logged in user then set this up as a script and use the run as features in a script
Posted by:
RoverDrover
13 years ago
Sorry for the delay -- I've been on a tractor miles from here.
What happened with the managed installation was, I set it to run the command manually and specified a label, and when I hit Save, it said something like "select a software program from the dropdown box."
I had tried to download and associate the batch file but it doesn't show up in the dropdown. That was the first thing I tried, and failing that, I tried to enter the simple command manually and it wouldn't save.
What I want to happen with a number of remote computers and laptops is that when they login, Windows maps drive x: to a shared folder on the server. I started doing it by making a new OU in Active Directory and applying a GPO to it, and I can't get that to work either. I can do it with the default domain GPO but not just one for this sub-group. So I though I'd try to do it via the Kbox.
Thank you guys for replying
Bob
What happened with the managed installation was, I set it to run the command manually and specified a label, and when I hit Save, it said something like "select a software program from the dropdown box."
I had tried to download and associate the batch file but it doesn't show up in the dropdown. That was the first thing I tried, and failing that, I tried to enter the simple command manually and it wouldn't save.
What I want to happen with a number of remote computers and laptops is that when they login, Windows maps drive x: to a shared folder on the server. I started doing it by making a new OU in Active Directory and applying a GPO to it, and I can't get that to work either. I can do it with the default domain GPO but not just one for this sub-group. So I though I'd try to do it via the Kbox.
Thank you guys for replying
Bob
Posted by:
cblake
13 years ago
An MI requires that a software inventory record be associated to it; since this isn't really software, recommended best practice would be to use scripting. You could certainly use an MI, but in this instance scripting is definitely the preferred and more sustainable option.
(Forgive the bad syntax below- off the cuff) Your script could be as simple as:
VERIFY:
X:\path exists.
SUCCESS:
Log something.
REMEDIATION:
launch "c:\windows\system32\net.exe" with parameters "use x: \\10.231.0.201\invoices"
Copy $KACE_dependancy_dir\shortcut.lnk to desktop
Log something.
Or
VERIFY:
"Launch a batch file"
--and your bat file runs whatever behavior you want.
We have a "bring your questions KKE" on Thursday at 10:00 Pacific where we'd be happy to demonstrate if you need it. Go to kace.webex.com and register for KKE's in the training center. This week's session is specifically for K2000 , but if there aren't K2 questions for the whole session we'll probably talk K1 if questions are out there.
(Forgive the bad syntax below- off the cuff) Your script could be as simple as:
VERIFY:
X:\path exists.
SUCCESS:
Log something.
REMEDIATION:
launch "c:\windows\system32\net.exe" with parameters "use x: \\10.231.0.201\invoices"
Copy $KACE_dependancy_dir\shortcut.lnk to desktop
Log something.
Or
VERIFY:
"Launch a batch file"
--and your bat file runs whatever behavior you want.
We have a "bring your questions KKE" on Thursday at 10:00 Pacific where we'd be happy to demonstrate if you need it. Go to kace.webex.com and register for KKE's in the training center. This week's session is specifically for K2000 , but if there aren't K2 questions for the whole session we'll probably talk K1 if questions are out there.
Comments:
-
This is what I've been trying to do. Push out a simple mapped drive through a script/batch file. The script never finishes though, so I tried what you wrote above - launch net.exe with the following parameters. I get the same result though - in Run Now Status is stays at running and never maps. I know my syntax is correct though because if I enter the same thing at a cmd prompt, it works fine. Not sure why I'm having an issue pushing it out through KACE. It's set as an online script to run as the logged in user, and I'm testing it on the machine I'm currently using. - nicolebeth 8 years ago
Posted by:
RoverDrover
13 years ago
Posted by:
airwolf
13 years ago
What do you mean it won't let you "save it"?
I've got a post-installation task that does this in the K2000, and it works fine. The same process should work fine as a managed installation. If it won't let you save a managed installation, perhaps you only have read permissions to that section of the K1000.
I've got a post-installation task that does this in the K2000, and it works fine. The same process should work fine as a managed installation. If it won't let you save a managed installation, perhaps you only have read permissions to that section of the K1000.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.