/build/static/layout/Breadcrumb_cap_w.png

KACE Product Support Question


K2000 Post Install Task - Pass Parameters to batch file

04/18/2017 1389 views
I want to pass a username and password to a Post Install task with a zipped batch file, but the task fails.

First example fails with a windows popup because it couldn't find the username and password.

Second example, the task error log indicates cmd.exe was not found in the task's folder.

I've tried calling the batch file like so:

Example 1
test.bat domain\username p@ssw4rd

Example 2
cmd.exe /q /c test.bat domain\username p@ssw4rd

Any suggestions? For now, I'm hard-coding the username and password in the batch file.

Contents of batch file

@echo off

if %1. == . (echo Username not provided && exit 1)
if %2. == . (echo Password not provided && exit 1)

set username1=%1
set password1=%2

rem comment out next 2 lines when done testing
Echo Username is %username1%
Echo Password is %password1%
cls

net use L: \\server.fqdn\sharename /USER:%username1% %password1% /persistent:no

2 Comments   [ + ] Show comments

Comments

  • Is the post-install task setup as a application and the parameter is what you placed in your example?
    • Yes, Chuck that is correct
      • Hmm. Do the echo statements show the username and password?
  • In a command prompt on my computer yes. The batch file never runs and the task fails in the K2000 post install though. I will instead look into doing it through powershell after seeing another post on itninja showing how to store credentials encrypted in an XML file.

Be the first to answer this question

 
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