Problem with running an exe from a form

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
MFelkins
Posts: 20
Joined: Mon Aug 20, 2007 3:07 am

Problem with running an exe from a form

Post by MFelkins » Fri Jun 15, 2012 8:45 am


Problem with running an exe from a form.

Here is my function:

Function Command($strComputer) {
if (Test-Port135($strComputer)) {
If (Test-Path $strComputerE$scriptsIIS7EnAble-redirection.js ){
e:scriptspsexec.exe -d -h $stComputer wscript E:scriptsIIS7EnAble-redirection.js
e:scriptsPSService.exe $strComputer restart wmsvc
}
Else {
$statusbar1.Text = $strComputer.Text
robocopy E:scriptsIIS7 "" + $strComputer + "E$scriptsIIS7 *.js"
e:scriptspsexec.exe -d -h $stComputer wscript E:scriptsIIS7EnAble-redirection.js
e:scriptsPSService.exe $strComputer restart wmsvc
}
}
}
The PSService gives me this error:


PSService.exe :
Shared-Config.pff (159): ERROR: At Line: 159 char: 30
ERROR: + e:scriptsPSService.exe <<<< $strComputer restart wmsvc
ERROR: + CategoryInfo : NotSpecified: (:String) [], RemoteException
ERROR: + FullyQualifiedErrorId : NativeCommandError
It does not appear to be picking up the $strComputer variable. I am also having trouble getting the $strComputer variable to show up in the $statusbar1.Text = $strComputer.

The odd thing is that e:scriptspsexec.exe -d -h $stComputer wscript E:scriptsIIS7EnAble-redirection.js runs fine.


Any ideas?MFelkins2012-06-15 15:51:08

User avatar
Alexander Riedel
Posts: 7023
Joined: Tue May 29, 2007 4:43 pm

Problem with running an exe from a form

Post by Alexander Riedel » Fri Jun 15, 2012 9:00 am

$strComputer doesn't work and $stComputer works?Typo?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
MFelkins
Posts: 20
Joined: Mon Aug 20, 2007 3:07 am

Problem with running an exe from a form

Post by MFelkins » Sat Jun 16, 2012 4:54 am

Yeah, Typo. BTW, If I do this:
$statusbar1.Text = "Server name is $strComputer" It works so that problem is solved. I'll check the other part on Monday.

User avatar
Alexander Riedel
Posts: 7023
Joined: Tue May 29, 2007 4:43 pm

Problem with running an exe from a form

Post by Alexander Riedel » Sat Jun 16, 2012 8:37 am

$statusbar1.Text = $strComputer.TextWhen you call your function are you calling it with a text box control as parameter or with a string? This all seems more like a language learning problem if I may say so and not a problem with the product per se.It seems our sister site Scriptinganswers.com would be a better place to discuss these types of problems.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
MFelkins
Posts: 20
Joined: Mon Aug 20, 2007 3:07 am

Problem with running an exe from a form

Post by MFelkins » Wed Jun 20, 2012 2:18 am

Yep, you are right. A typo and a brain freeze. Thanks for your time.