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   [ - ] Hide 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.
Please log in to comment

There are no answers at this time
Answer this question or Comment on this question for clarity