I created a new Project. I created this on a Windows 7 x64 workstation but when I did a "build" I built it for PS 2.0 and x86. all of our Windows 7 workstations are running PS 2.0 on a 32-bit OS.
when I run the compiled .EXE it pops up my GUI but it also pops up a CMD window. We don't want that. I want it to be 100% GUI.
How do I make this run without a CMD window?
How do you run without a CMD window?
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.
Re: How do you run without a CMD window?
I moved this to the product forum since it isn't a scripting question.
When making your packaged executable, select the following engine:
SAPIEN PowerShell V2 Host (Windows Forms) Win32
David
When making your packaged executable, select the following engine:
SAPIEN PowerShell V2 Host (Windows Forms) Win32
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: How do you run without a CMD window?
Both Windows and Windows Form engines will hide the console window. The difference between the two is that the Forms engine suppresses all output and the Windows engine pops up message boxes for output.
David
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: How do you run without a CMD window?
ok, I click on the Deploy Tab\Build. From there I have a Script Packager options window. Under PLATFORM I do NOT have any executable options. I only have (command line) & (Windows forms)
so I picked (Sapien PowerShell v2 Host (Windows Forms) Win32. Now when I run my tool it does not complete. It should prompt me for "computer name" and "message to send" I only see the first prompt, not the second so my NetSend message never runs.
Do I have the right version of this tool? or am I missing functionality?
so I picked (Sapien PowerShell v2 Host (Windows Forms) Win32. Now when I run my tool it does not complete. It should prompt me for "computer name" and "message to send" I only see the first prompt, not the second so my NetSend message never runs.
Do I have the right version of this tool? or am I missing functionality?
Re: How do you run without a CMD window?
What are you using to prompt the users? This really depends on what you are doing in your script.
When using a GUI I recommend incorporating the input into the form or create a separate form to handle the input.
David
When using a GUI I recommend incorporating the input into the form or create a separate form to handle the input.
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: How do you run without a CMD window?
I have created 1 form. On this form I have 2 buttons. Here is the exact code for each button.
$buttonSendMSGTo1Computer_Click={
#TODO: Place custom script here
$computer = Read-Host -Prompt "Enter a single computer name"
$Message = Read-Host -Prompt "Enter your message here"
msg /SERVER:$computer * /TIME:200 $Message
}
$buttonSendMSGToAllComputer_Click={
#TODO: Place custom script here
import-module activedirectory
$Message = Read-Host -Prompt "Enter your message here"
New-Item -ItemType directory -Path "C:\Temp"
(Get-ADComputer -Filter * -SearchBase "ou=mgh_workstations,dc=acmel,dc=org").Name | Out-File c:\temp\allWin7.txt
$pc = Get-Content "c:\Temp\allWin7.txt"
foreach ($desktop in $pc)
{
msg /SERVER:$desktop * /TIME:2000 $Message
}
remove-item "c:\Temp\allWin7.txt"
}
So each button when pressed launches a new pop-up window that you enter text into. When I compile this into an .EXE and run it the pop-up is Not in the form of a GUI but it launches a .CMD window to ask me the computer name/message.
$buttonSendMSGTo1Computer_Click={
#TODO: Place custom script here
$computer = Read-Host -Prompt "Enter a single computer name"
$Message = Read-Host -Prompt "Enter your message here"
msg /SERVER:$computer * /TIME:200 $Message
}
$buttonSendMSGToAllComputer_Click={
#TODO: Place custom script here
import-module activedirectory
$Message = Read-Host -Prompt "Enter your message here"
New-Item -ItemType directory -Path "C:\Temp"
(Get-ADComputer -Filter * -SearchBase "ou=mgh_workstations,dc=acmel,dc=org").Name | Out-File c:\temp\allWin7.txt
$pc = Get-Content "c:\Temp\allWin7.txt"
foreach ($desktop in $pc)
{
msg /SERVER:$desktop * /TIME:2000 $Message
}
remove-item "c:\Temp\allWin7.txt"
}
So each button when pressed launches a new pop-up window that you enter text into. When I compile this into an .EXE and run it the pop-up is Not in the form of a GUI but it launches a .CMD window to ask me the computer name/message.
Re: How do you run without a CMD window?
As I mentioned you are better off using your own custom GUI instead of relying on Read-Host.
The Window Forms engine isn't meant to be used for Host output or input. Try using the Windows engine instead of the Forms engine and see if that makes a difference.
I recommend reading this article:
http://www.sapien.com/blog/2012/06/04/u ... istrators/
David
The Window Forms engine isn't meant to be used for Host output or input. Try using the Windows engine instead of the Forms engine and see if that makes a difference.
I recommend reading this article:
http://www.sapien.com/blog/2012/06/04/u ... istrators/
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.