**NOTE: Script code is provided as a courtesy by KACE to its customers. We make no promises as to workability or functionality under certain circumstances. In default situations under normal setup these work as designed. KACE does not support modification nor usage. We highly recommend you test all code no matter the source before using in a production environment. If you are cut and pasting the code, paste in to a text editor then copy back out to remove any hidden characters or markup.**
Method 1: Running a Windows PowerShell command using a Batch file
Batch command line used:
powershell -command "& {gwmi win32_product |? {$_.name -match 'KACE Agent'}|Out-File AgentInfo.txt}"
NOTE: AgentInfo.txt will be created in KACE Dependency directory.
=====================================================================================================================
Method 2: Executing an existing Windows PowerShell script directly
Command line(s) used:
Directory: $(KACE_DEPENDENCY_DIR)
File: powershell.exe
Parameters: -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file "CreateShortCut.ps1"
We can easily refer to the dependency file "CreateShortCut.ps1" attached (see above screenshot) since powershell.exe is known inside the $(KACE_DEPENDENCY_DIR), which is the actual directory the script will be downloaded to on the device.
NOTE: The actual task the script is performing cannot be debugged using the K1000 directly and error logging and debugging has to be implemented by the author of the script. Furthermore it is important to remember that KACE Scripts are executed under the LOCAL SYSTEM context in Windows (per default settings) plus, they are running in a 32x Bit environment. This is specifically important when executing scripts on 64x Bit machines and i.e. querying the 32x Bit portion of the Windows Registry.
© ALL RIGHTS RESERVED. Nutzungsbedingungen Datenschutz Cookie Preference Center