Kace 6.3 Scripting
if i do an Online shell Script and type the code in, It keeps failing saying
Error 402 received while sending dependency DisableFeatures.bat to client
I am pushing a script to a machin and users that have Full Administrative rights and i cant seem to figure out why it keeps failing.
I can see where it uploads the script and it says that it was ran succesfully when i run as an online shell script but nothing actually happens
my script for the bat file is to disable features on a PC that is not needed. See below and please i would like any help i can get
dism /online /disable-feature /featurename:MediaCenter /NORESTART
dism /online /disable-feature /featurename:OpticalMediaDisc /NORESTART
dism /online /disable-feature /featurename:TabletPCOC /NORESTART
dism /online /disable-feature /featurename:WindowsGadgetPlatform /NORESTART
Answers (4)
if defined ProgramFiles(x86) (
SET LOC=C:\windows\sysnative
) else (
SET LOC=C:\windows\system32
)
%LOC%\dism.exe /online /disable-feature /featurename:MediaCenter /NORESTART
%LOC%\dism.exe /online /disable-feature /featurename:OpticalMediaDisc /NORESTART
%LOC%\dism.exe /online /disable-feature /featurename:TabletPCOC /NORESTART
%LOC%\dism.exe /online /disable-feature /featurename:WindowsGadgetPlatform /NORESTART
The fact that Kace is lacking a 64 bit client drives me crazy. We are forced to create a frankenstein mess.
I have decided that I will run everything through a wrapper. I have a template kscript that has everything set to use a Powershell PSAppDeploy Toolkit zipped package. All I have to do is change the name and upload the Toolkit.zip. The Template has the unzipping, execution and logging already setup. Even if I am making a very small change I still do this to keep everything uniform and ensure I didn't miss anything.
For Managed Installations I am using a wrapper script to launch my kscripts. That way I am not having to make a script in kscripting and in Managed Installs and get a "Run Now" sort of ability in Managed Installs. The wrapper I use is just this:
@echo off
SET SCRIPT=%1
if defined ProgramFiles(x86) (
"%PROGRAMFILES(X86)%\Dell\KACE\runkbot.exe" %SCRIPT% 0
) else (
"%PROGRAMFILES%\Dell\KACE\runkbot.exe" %SCRIPT% 0
)
It is pretty simple and I just run a custom command in the managed installed that is wrapper.bat followed by the script ID number of the Kscript. If you KScript is a script ID of 140, the Managed Install command would be:
wrapper.bat 140
The same can be said for my Custom Inventory Items. I find that the ShellTextReturn is a very useful option, but even using a if/else I have a lot of issues with them sometimes. I tend to structure my Custom Inventory Rules like this:
if defined ProgramFiles(x86) (C:\windows\sysnative\Manage-BDE.exe -status C: | findstr /C:"Protection Off") else (Manage-BDE.exe -status C: | findstr /C:"Protection Off")
I have had so many issues spread all over my kbox that have been caused by this. I am still not done correcting everything and converting everything over to these sort of methods. It is a very long a tedious process, but in the end going back and auditing will be a breeze. While auditing mine I found so many hidden issues that I was unaware of that were missed because of this issue. The next time I go back and audit my K1000, everything will be uniform and packaged and used in the exact same way.
There is an issue when you can create a config policy under the scripting section with their Wizard and it is broken on 64 bit machines...
Comments:
-
The script works. i actually use this as a post install task on the K2000 box when i build PC's. See below for my comments. Also the PC is my PC and all accounts have full admin users rights. I used the action to run as logged on users.
I have attache screen shots in the below comments - bblank05 9 years ago
Comments:
-
i edited the script to reflect that but it still doesn't work. If i create a .bat file the script works fine. When i add it into Kace it doesn't work - bblank05 9 years ago
This is exactly what i am putting in the script text in Kace. I know the script works because i use this script on the K2000 as a post install task to disable features when i build new PC's
dism /online /disable-feature /featurename:MediaCenter /NORESTART
dism /online /disable-feature /featurename:OpticalMediaDisc /NORESTART
dism /online /disable-feature /featurename:TabletPCOC /NORESTART
dism /online /disable-feature /featurename:WindowsGadgetPlatform /NORESTART
Not sure if there are any steps im missing but this is what ive got. As soon as i save the script it adds a dependency at the top. When i go to the kace Script folder in program data i see the script but when it runs the cmd window pops up and nothing happens.
I have tried to run the script on both Kace script and online shell script. I either get a success with no results or an error 404.
This command only works when run from Kace and wont work when tested locally on a machine. - AndyH 9 years ago