Powershell and VBscript: running PS from VBscript and issue returning value back to VBScript
-
Friday, March 08, 2013 5:34 PMI am calling powershell script from Vbscript. How can i pass variable value back to vbscript from powershell function or script (either way)?
I am expecting msgbox output or msgbox TestFn to display Hello World but both of them dispaly blank/nothing.
Test1.vbs:
--------
set shell = createobject("wscript.shell")
shell.run("powershell.exe -file C:\Scripts\TestFn.ps1")
output=TestFn
msgbox output
msgbox TestFn
TestFn.ps1
------------
function TestFn
{
$a = "Hello World"
return $a
}
All Replies
-
Friday, March 08, 2013 5:53 PMModerator
They are separate processes without any inter-process communication, so that's not going to work (as you have already found out).
What problem will this solve?
Bill
-
Friday, March 08, 2013 5:58 PM
This is just a example I am trying.
But I am trying to use encrypted password and trying to access that password from vbscript and use it in the VBScript.
-
Friday, March 08, 2013 6:05 PMModerator
Is this related to your earlier question?
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/47a7199b-d105-4b04-8d26-f249885167b6
If so, then the answer is in your other question. ConnectServer will not accept an encrypted password. You must pass it a plain text password.
Is your real question about how to get an input password in VBScript and hide it as it's being typed?
Bill
-
Friday, March 08, 2013 6:22 PM
Yes Bill. Sorry for two threads. Yes. that was my question. So there is no way to hide password when using ConnectServer in Vbscript?
-
Friday, March 08, 2013 6:29 PMModerator
Just wanted to clarify the question.
You can do it from an HTA, which is an HTML application. In this case you can use the <input type="password"> HTML element.
You can do it from a shell script (batch file) by using the editv32.exe (or editv64.exe) program that I wrote a while back. This program lets you interactively edit an environment variable and it supports masked input using the -m parameter.
There is not a direct way to retrieve input in a VBScript script and hide it while it is being typed.
Bill
- Proposed As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Friday, April 05, 2013 10:27 PM
- Marked As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Sunday, April 14, 2013 2:55 PM

