/build/static/layout/Breadcrumb_cap_w.png

Kace 6.3 Scripting

I am Totally lost on way i cant send a simple script through the KACE scripting Section.
 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

4 Comments   [ + ] Show comments
  • Scripts using the registry in windows 7 64bit have to use c:\windows\sysnative\reg.exe, so you could try c:\windows\sysnative\dism.exe

    This command only works when run from Kace and wont work when tested locally on a machine. - AndyH 9 years ago
  • Where is the sysnative folder? I dont see that - bblank05 9 years ago
  • Never mind. I now understand the sysnative. I applied it to the script and it worked. Thanks a bunch - bblank05 9 years ago
  • Welcome! Glad it helped. - AndyH 9 years ago

Answers (4)

Answer Summary:
Posted by: gerane 9 years ago
Yellow Belt
0
If this is a script being ran against 32 and 64 bit Machines you might want to use something like the following.

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...


Posted by: h2opolo25 9 years ago
Red Belt
0
General Troubleshooting:
Run script locally and see if it works
In the script check the "Select Specific Operating System" box and select Microsoft Windows
Make sure to run as a user that has the proper rights. 
Sometimes "Local System" is not going to work because some scripts need a profile to run.

Attach a screenshot of your Tasks section. It will help narrow down what the issue is. 

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
Posted by: SMal.tmcc 9 years ago
Red Belt
0
If these are 64bit it is the sysnative problem.  The client is 32 bit so it calls the 32 bit version of dism.  use c:\windows\system32\dism.exe

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
Posted by: bblank05 9 years ago
Yellow Belt
0
So when i run the script i get the following saying that it ran successfully but the results show that it didn't do anything




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 website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ