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
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
-
Is the post-install task setup as a application and the parameter is what you placed in your example? - chucksteel 7 years ago
-
Yes, Chuck that is correct - flip1001 7 years ago
-
Hmm. Do the echo statements show the username and password? - chucksteel 7 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 7 years ago
Answers (0)
Please log in to answer
Be the first to answer this question