/bundles/itninjaweb/img/Breadcrumb_cap_w.png

Blog Posts tagged with Kace Scripting

Ask a question

Reading Registry DWORD in KACE Scripts

If you are having problems returning a known registry value that is a DWORD value try this.

Instead of scripting your value as KEY = 0x00000001

Use KEY = 1

Yes its that simple. KACE expects the data in the same format that the registry itself has you input it.

Be the first to comment

Empty Users Recycle Bins

Heres a quick batch that will empty those full recycle bins and reclaim disk space.

Using this on servers is also a great way to reclaim space as the files deleted are typically bigger and most admins arent too good at remembering to do the small maintenance tasks such as taking out this

@echo off
echo This batch file will permanently remove all users recycled files/folders.

echo ----------------------------------------------------------------------------
echo You're about to clear the following folder:
rd /s c:\recycler
pause

For windows 7 use  C:\$Recycle.Bin

Be the first to comment

Using copy command in your K1000 scripts

When you try to use the copy/xcopy command in a bacth included as a dependencay in your script you will get a silent failure.

No error returned

No file copied

I get questions about this several times a week.

The solution?


Instead of :
xcopy C:\Programdata\Dell\Kace\Kbox\path\kbot\package\file.ext  %userprofile%\Desktop\

Use the following instead:
start /wait xcopy C:\Programdata\Dell\Kace\Kbox\path\kbot\package\file.ext  %userprofile%\Desktop\

This also works with other commands that have issues running from withing the Scripting enviroment in KACE because they try to execute before the script releases control of the files they are trying to manipulate.

Give it a try.

Be the first to comment

Dell KACE and Deep Freeze: Using Scripting to Freeze and Thaw Systems

Introduction

 

Customers who use Deep Freeze need a way to unfreeze their systems in order to do patching and system maintenance and then refreeze the system to allow for normal day to day operation. This guide covers creating scripts for enabling and disabling Deep Freeze for both Windows and Mac systems via the KACE Systems Management Appliance.

After completing this document, you should be able to:

·         Understand the process for creating scripts for freezing and unfreezing Windows computers

·         Understand the process for creating scripts for freezing and unfreezing Macintosh computers


 

Deep Freeze for Windows

 

Thawing Your System

 

Before changes can be made to a computer secured by Deep Freeze, it must be put into a writeable state. This process is known as “Thawing” and can be accomplished with a simple KScript.

·         In the Scripting module, click “Choose Action”, then click “New

QwLTD4.png

 

·         Name your script “Deep Freeze – Boot Thawed” and select Online Kscript from the Type dropdown. You can also input a description of what the script does.

·         Under the Deploy section, uncheck the Select Specific Operating Systems box and then click “Microsoft Windows”. You can also choose what systems to deploy the script to from this section.

·         In the Tasks section, find the Verify option and click “Add”.

·         Choose “Verify a directory exists” and input “%PROGRAMFILES(X86)%” in the text box (without quotes) and click “Save Changes”

·         Go to the On Success section and click “Add”, then select “Launch a program” from the dropdown and enter the following information into the fields:

o   Directory: $(KACE_SYS_DIR)\syswow64

o   File: DFC.exe

o   Check the “Wait for completion” box

o   Parameters: dellkace /BOOTTHAWED

o   Click “Save Changes”

·         Go to the Remediation section and click “Add”, then select “Launch a program” from the dropdown and enter the following information into the fields:

o   Directory: $(KACE_SYS_DIR)\system32

o   File: DFC.exe

o   Check the “Wait for completion” box

o   Parameters: dellkace /BOOTTHAWED

o   Click “Save Changes”

 

Note:

The dellkace entry in the Parameters field is the password for  the thaw command. Replace that entry with the password for your DeepFreeze software.

 

·         Scroll to the bottom of the page and click “Save”

Twr96N.png

You may run this script on demand by choosing the “Run Now” option, or schedule it to run on whatever schedule you prefer.

 

 


 

Freezing Your System

 

Once changes have been made to the system, it will need to be placed back in a “Frozen” state. Use the following steps to create a script to freeze the target PC.

 

·         In the Scripting module, click “Choose Action”, then click “New

·         Name your script “Deep Freeze – Boot Frozen” and select Online Kscript from the Type dropdown. You can also input a description of what the script does.

·         Under the Deploy section, uncheck the Select Specific Operating Systems box and then click “Microsoft Windows”. You can also choose what systems to deploy the script to from this section.

·         In the Tasks section, find the Verify option and click “Add”.

·         Choose “Verify a directory exists” and input “%PROGRAMFILES(X86)%” in the text box (without quotes) and click “Save Changes”

·         Go to the On Success section and click “Add”, then select “Launch a program” from the dropdown and enter the following information into the fields:

o   Directory: $(KACE_SYS_DIR)\syswow64

o   File: DFC.exe

o   Check the “Wait for completion” box

o   Parameters: dellkace /BOOTFROZEN

o   Click “Save Changes”

·         Go to the Remediation section and click “Add”, then select “Launch a program” from the dropdown and enter the following information into the fields:

o   Directory: $(KACE_SYS_DIR)\system32

o   File: DFC.exe

o   Check the “Wait for completion” box

o   Parameters: dellkace /BOOTFROZEN

o   Click “Save Changes”

·         Scroll to the bottom of the page and click “Save”

vZ7Jdv.png

You may run this script on demand by choosing the “Run Now” option, or schedule it to run on whatever schedule you prefer.

Deep Freeze for Macintosh

 

Thawing Your System

 

·         In the Scripting module, click “Choose Action”, then click “New

·         Name your script “Deep Freeze – Boot Thawed” and select Online Shell Script from the Type dropdown. You can also input a description of what the script does.

·         Under the Deploy section, uncheck the Select Specific Operating Systems box and then click “Mac OS X”. You can also choose what systems to deploy the script to from this section.

·         In the Script section, input the following commands:

#! /bin/sh

 

# Thaw Deep Freeze Mac Client

 

echo - Deep Freeze Mac Thaw Executing

 

DFXPSWD=dellkace /Library/Application\ Support/Faronics/Deep\ Freeze/deepfreeze -u dellkace -p bootThawed

 

echo - Rebooting system

shutdown -r now

 

·         In the Script File Name box, name the script DPM_Thawed.sh

·         Scroll to the bottom of the page and click “Save”

 

krzv92.png

You may run this script on demand by choosing the “Run Now” option, or schedule it to run on whatever schedule you prefer.

Freezing Your System

 

·         In the Scripting module, click “Choose Action”, then click “New

·         Name your script “Deep Freeze – Boot Frozen” and select Online Shell Script from the Type dropdown. You can also input a description of what the script does.

·         Under the Deploy section, uncheck the Select Specific Operating Systems box and then click “Mac OS X”. You can also choose what systems to deploy the script to from this section.

·         In the Script section, input the following commands:

#! /bin/sh

 

# Thaw Deep Freeze Mac Client

 

echo - Deep Freeze Mac Freeze Executing

 

DFXPSWD=dellkace /Library/Application\ Support/Faronics/Deep\ Freeze/deepfreeze -u dellkace -p bootFrozen

 

echo - Rebooting system

 

shutdown -r now

 

·         In the Script File Name box, name the script DPM_Frozen.sh

·         Scroll to the bottom of the page and click “Save”

zk39Nt.png

You may run this script on demand by choosing the “Run Now” option, or schedule it to run on whatever schedule you prefer.

Conclusion

 

By following the steps in this guide, you should be able to create the scripts necessary for freezing and thawing your computers. This will allow you to manage your systems, update security patches and deploy software to the computers without sacrificing the security provided by the Deep Freeze application. 
View comments (4)

Understanding Pipe commands to enhance your scripts

Since the Kace 1000 scripts and CIR's can call the command interpreter use can use pipe commands to chain code together for better flow

y2B96v.jpeg

examples of pipes I use within the k1000

In CIR's

ShellCommandTextReturn(cmd /c cscript /b c:\programdata\dell\kace\user\fadmins.vbs & type c:\programdata\dell\kace\user\filteredadmins.txt )

In Kscripts and batch commands

reg.exe query hkcu\software\microsoft\windows\currentversion\run /s > C:\ProgramData\Dell\KACE\user\hkcuRunKeys.txt && if "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg.exe query hkcu\software\wow6432node\microsoft\windows\currentversion\run /s >> C:\ProgramData\Dell\KACE\user\hkcuRunKeys.txt

for %%g in (c:\programdata\dell\kace\user\tempsw.txt) do (findstr /v /b /c:"ECHO is" %%g > c:\programdata\dell\kace\user\allsw.txt) & del c:\programdata\dell\kace\user\tempsw.txt /q
rename c:\programdata\dell\kace\user\allsw.txt tempsw.txt & for %%g in (c:\programdata\dell\kace\user\tempsw.txt) do (findstr /v /b /c:"Public" %%g > c:\programdata\dell\kace\user\allsw.txt) & del c:\programdata\dell\kace\user\tempsw.txt /q
REM  ::THIS SECTION BUILDS THE FILTERS TO REMOVE SOFTWARE THAT IS DEEMED OK BY IT::
REM ::this line removes Windows sidebar from the list::
rename c:\programdata\dell\kace\user\allsw.txt tempsw.txt & for %%g in (c:\programdata\dell\kace\user\tempsw.txt) do (findstr /v /b /c:"Sidebar" %%g > c:\programdata\dell\kace\user\allsw.txt) & del c:\programdata\dell\kace\user\tempsw.txt /q

 
View comments (1)
Showing 1 - 5 of 6 results

Top Contributors

Talk About App-V Sequencing