/build/static/layout/Breadcrumb_cap_w.png

K1000: How do you push Scripts (Invisibly) to your Workstations?

This is how I do it. I am trying to figure out if I am missing something that would make this process less annoying, but here it is:

  1. Create new offline KScript
  2. Attach all the dependencies I am going to need.
  3. One of these dependencies is "invis.vbs" which just takes in a batch file and executes it.
  4. Create a task which executes the program %systemroot%\system32\wscript.exe with parameters $(KACE_DEPENDENCY_DIR)\invis.vbs  $(KACE_DEPENDENCY_DIR)\BATCH_FILE.bat
Now all of the above is set up as such simply so I can run a batch file invisibly, with no possiblity of interaction with the user.
 
In that batch file, if I want to interact with any of the dependencies, I have to CD to the depedency directory, that is C:\programdata\dell\kace\kbots_cache\packages\kbots\<SCRIPT NUMBER>

This makes the script essentially only usable when run by the kagent, and also that I have to create the kscript before I can figure out what the number is going to be.
 
If I want to make use of powershell, I have to include the powershell commands via batch like this:
powershell -command "& {gwmi win32_product |? {$_.name -match 'Adobe Reader'}}"
 
I haven't figured out how to run powershell scripts silently.

How do you push scripts invisibly? There has to be a more elegant way...

1 Comment   [ + ] Show comment
  • %~dp0 resolves to the full path leading up to the script. I.E. the working directory that the script was run from.

    I now use this method in order to ensure the script knows where it's dependencies are. - muebel 10 years ago

Answers (2)

Posted by: dugullett 11 years ago
Red Belt
4

Are you referring to the CMD prompt that pops up for a few seconds? I've had success using http://www.f2ko.de/programs.php?lang=en&pid=b2e I first create a .bat with something like this:

@echo off

powershell.exe -nologo -executionpolicy bypass -noprofile -file script.ps1

Then using the converter I include my .ps1 file. This will compile the powershell script as an exe and it will deploy silently.

 

I've also used shell scripts to deploy Powershell. Just upload the .ps1 as a dependency and add this. Make sure to change to script.bat at the bottom. (Still displays the CMD prompt for a couple of seconds)


Comments:
  • So the actual answer is:-

    THE K1000 CANNOT RUN VBSCRIPT OR POWERSHELL SCRIPTS WITHOUT A BLACK CMD BOX POPPING UP FOR AT LEAST A FEW SECONDS.

    This is because the K1000 agent does not support windows scripting or powershell requiring you to run cscript.exe or powershell.exe programs in cmd windows or BAT file.

    I'd love someone to show me how, other than use software to convert scripts into executable program files. - Geedoubleu 10 years ago
  • I use wscript.exe to run the invis.vbs script silently - muebel 10 years ago
Posted by: jknox 11 years ago
Red Belt
1

Another option would be to attach the batch (outside of the .vbs) as a dependency and use the "Launch a program" feature calling "file.bat" for example.

That should not pop up the batch window.

 
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