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 LICENSE NUMBERS, ACTIVATION 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.
This topic is 11 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
MFelkins
Posts: 20
Last visit: Mon Aug 25, 2014 10:05 am

Problem with running an exe from a form

Post by MFelkins »


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: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Problem with running an exe from a form

Post by Alexander Riedel »

$strComputer doesn't work and $stComputer works?Typo?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
MFelkins
Posts: 20
Last visit: Mon Aug 25, 2014 10:05 am

Problem with running an exe from a form

Post by MFelkins »

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: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Problem with running an exe from a form

Post by Alexander Riedel »

$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
Last visit: Mon Aug 25, 2014 10:05 am

Problem with running an exe from a form

Post by MFelkins »

Yep, you are right. A typo and a brain freeze. Thanks for your time.
This topic is 11 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.