Problem with running an exe from a form
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.
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.
Problem with running an exe from a form
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
- Alexander Riedel
- Posts: 8478
- Last visit: Tue Mar 26, 2024 8:52 am
- Been upvoted: 37 times
Problem with running an exe from a form
$strComputer doesn't work and $stComputer works?Typo?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Problem with running an exe from a form
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.
$statusbar1.Text = "Server name is $strComputer" It works so that problem is solved. I'll check the other part on Monday.
- Alexander Riedel
- Posts: 8478
- Last visit: Tue Mar 26, 2024 8:52 am
- Been upvoted: 37 times
Problem with running an exe from a form
$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.
SAPIEN Technologies, Inc.
Problem with running an exe from a form
Yep, you are right. A typo and a brain freeze. Thanks for your time.