K2000 Post Install Task - Pass Parameters to batch file

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%

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

2 Comments   [ + ] Show comments
  • Is the post-install task setup as a application and the parameter is what you placed in your example? - chucksteel 4 years ago
    • Yes, Chuck that is correct - flip1001 4 years ago
      • Hmm. Do the echo statements show the username and password? - chucksteel 4 years ago
  • 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. - flip1001 4 years ago

Answers (0)

Be the first to answer this question

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


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