Script to change KACE appliances for Mac (AMPTools)
We have three KACE appliances here, for development, testing and production. On the Windows side, we have a KACE script that can remotely re-point a client with the AMPTools host=[server] command. I've been trying to create a similar script that works for the Mac OS. I've tried just about every approach I can think of from launching sudo from /usr/bin to putting the entire sequence in a shell script and launching that:
#!/bin/bash
cd /Library/Application\ Support/Dell/KACE/bin
sudo ./AMPTools host=[our-dev-server]
The Run Now log shows a successful completion and the script runs just fine from the Terminal, but the target server on the client doesn't change. Any ideas what I'm doing wrong?
Thanks
Ric
4 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
chucksteel
9 years ago
The KACE client runs with root privileges so you don't need to use sudo. I haven't done this with KACE but I have used Apple Remote Desktop and just send this command:
/Library/Application\ Support/Dell/KACE/bin/AMPTools set host=newhost
Comments:
-
Chuck, I did try this with the sudo removed and that didn't help. I also noticed that running the script also stops the AMPAgent service. Unfortunately we only have ARD running in a couple of isolated labs so that tool isn't available to me.
I noted that your command included "set" host=... and I tried that, as well, without success.
For the record, running the KACE Agent 6.3.314 on Mac OS 10.10.3 - rgetter 9 years ago-
I wonder if a better approach would be to upload a amp.conf file with the new host line set as you wish and then have the script replace the file using a file copy. You would then need to restart the AMPTools service also, or just wait for the machine to restart. - chucksteel 9 years ago
-
Chuck,
I gave that a try, using both an AMPTools restart and a an AMPTools stop followed by a start in the script and that left the system in a state where it wasn't connected to either system. My "get" looks like this:
KACE Agent version 6.3.314 Apr 13 2015
Config: debug: false
Config: config: amp.conf
Config: host: pcckboxdev.pcc.edu
Config: lasthost: pcckbox.pcc.edu
Config: serverversion: 6.3.113399
Config: appliance: k1000
Config: ampport: 52230
Config: ampurl: https://pcckbox.pcc.edu:52230
Config: webport: 443
Config: weburl: https://pcckbox.pcc.edu
Config: hideapps:
Config: rto: 20
Config: wto: 20
Config: cto: 10
Config: crto: 30
Config: max download speed: unlimited
Config: KSWMeterSvc max db rows: 5000
Config: krash: false
Config: pl: pluginDesktopAlerts,pluginPatchin... (etc)
I have the amp.conf file attached as a dependency and my script looks like this:
#!/bin/bash
# redirects a KACE client to pcckboxdev - rgetter 070215
cd ${0%/*}
mv -f amp.conf /Library/Application\ Support/Dell/KACE/data
# restart the AMPAgent
/Library/Application\ Support/Dell/KACE/bin/AMPTools stop
/Library/Application\ Support/Dell/KACE/bin/AMPTools start
This is really strange. It was so easy to do this on Windows.
(And thanks for your help on this) - rgetter 9 years ago -
I'm guessing that things get wonky when the script loses connection during the change. Perhaps it would be better to have your script schedule the AMPTools command to run a few minutes into the future using the at command. - chucksteel 9 years ago
I just noted that the amp.conf file reverts back to the original appliance after a while. It's like the KBOX is protecting itself from a change to the amp.conf file. - rgetter 9 years ago
Do you have any hints on what the at command syntax would look like. I've been testing it interactively and keep getting a "garbled time" error. I've been trying things like:
at -f 'myscript.sh' now + 1 min
or
echo [path/to/myscript.sh] | at now + 1 min
(these are some ideas I found on various Linux forums)
Thanks Chuck - rgetter 9 years ago
Thanks! - rgetter 9 years ago