Product, version and build: Powershell Studio 2015 (will provide version/build later - not at my PC.
(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product: 64bit
Operating system: Win7 Enterprise
32 or 64 bit OS: 64 bit
PowerShell Version: 5
DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
I am currently working on a GUI app used to create Build Sheets for PCs that need to be replaced at work. The problem I'm having is how to use the "form" I created in PS Studio in order to create a printable Build Sheet for each PC. I saved the form as a PSF file and I'm sure there is a way...I just can't figure it out. I tried the Technet PS forum but they weren't much help. If using a PS Form is not the way to go, that's fine, but I hope I'm on the right trail.
Brian
How to use Powershell Forms to create and fill printable doc
Forum rules
Do not post any licensing information in this forum.
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 any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: How to use Powershell Forms to create and fill printable doc
If I'm understanding correctly you simply want to be able to run the form that you made on another machine?
If so, there's a number of ways to do this. You can package it into an executable and run the executable, you can export it into a ps1 script and just run the script on a machine, or you can package it into an MSI and install it on a target machine.
This article here: http://info.sapien.com/index.php/packag ... imalscript should be able to help you get started, it shows you how to use PrimalScript, but the functionality is pretty much the same for PowerShell Studio.
And if you have any questions regarding this process let me know and I'll be happy to help.
If so, there's a number of ways to do this. You can package it into an executable and run the executable, you can export it into a ps1 script and just run the script on a machine, or you can package it into an MSI and install it on a target machine.
This article here: http://info.sapien.com/index.php/packag ... imalscript should be able to help you get started, it shows you how to use PrimalScript, but the functionality is pretty much the same for PowerShell Studio.
And if you have any questions regarding this process let me know and I'll be happy to help.
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: How to use Powershell Forms to create and fill printable doc
A quick clarification, if you're going to package your form into an executable and use that, make sure to use one of the engines with (Windows Forms) in the name.
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: How to use Powershell Forms to create and fill printable doc
What I want to do is run a script (shortcut, exe, etc), which gathers data about any PCs that are past our 5 year Refresh date, then print out a document, which is a one page doc with a specific PC's info on it. It will print out one "Build Sheet" for each PC name entered into the main GUI. I had been using Access to print out the forms but I want to automate the process of creating and printing the Build Sheets and we don't have any support for Access at work, so I'm trying to switch the DB over to SQL Server. I hope I didn't give you too much extraneous information.
Re: How to use Powershell Forms to create and fill printable doc
Unfortunately, this seems more like a scripting based question as opposed to a product specific question. If so, then this belongs in the Windows PowerShell or PowerShell GUIs forum so the community can help out with this.
That being said, they're going to need more information to go off of such as what you've got so far for your script, what you've tried and what kind of information exactly you're wanting to get about your PC's.
That being said, they're going to need more information to go off of such as what you've got so far for your script, what you've tried and what kind of information exactly you're wanting to get about your PC's.
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: How to use Powershell Forms to create and fill printable doc
Just to set you expectations, Windows Forms and PowerShell have no inherent support for printing. You would have to either use a plain text report and use a script to generate the text or add hand coded support for formatted printing. YOU could also use Word or Excel to create a formatted document.
You could just use SYSTEMINFO.EXE to generate a report of all installed software and hardware. SYSTEMINFO can be run remotely.
systeminfo /S remotepc
systemindo /?
You could just use SYSTEMINFO.EXE to generate a report of all installed software and hardware. SYSTEMINFO can be run remotely.
systeminfo /S remotepc
systemindo /?
Re: How to use Powershell Forms to create and fill printable doc
Hi Bembree,
well, a form project is exactly the right tool for that.
You can generate a list of computers by scanning for them and adding all names that meet the criteria.
Then add a button to the form and doubleclick on it: Your editor will shift to a scriptblock, that will run when the button is clicked.
Add in code that checks the selection in your list and for each computer, do your status scan and emit a file.
Now how to best do each individual step is a bit more of a tall order. For "how do I make the GUI work?" check out the tutorials in the Sapien Knowledgebase and companies' blog (they are good). If you then still have trouble with the GUI parts, ask them here.
For individual pieces of information you want to retrieve from the target computer, either try google or the PowerShell/Scripting forums here or on TechNet.
Cheers,
Fred
well, a form project is exactly the right tool for that.
You can generate a list of computers by scanning for them and adding all names that meet the criteria.
Then add a button to the form and doubleclick on it: Your editor will shift to a scriptblock, that will run when the button is clicked.
Add in code that checks the selection in your list and for each computer, do your status scan and emit a file.
Now how to best do each individual step is a bit more of a tall order. For "how do I make the GUI work?" check out the tutorials in the Sapien Knowledgebase and companies' blog (they are good). If you then still have trouble with the GUI parts, ask them here.
For individual pieces of information you want to retrieve from the target computer, either try google or the PowerShell/Scripting forums here or on TechNet.
Cheers,
Fred
Re: How to use Powershell Forms to create and fill printable doc
The real issue here is that old thing about printing a form from a GUI with PowerShell. There is really no internal method in forms or PowerShell, PowerShell Studio to do this.
This issue came up a few years ago and I had to apply my knowledge of printing in C# to PS. I found the old form (it was still a V1 PFF file) and cleaned up the code to make a simple demo of how to print the form on the screen to a printer. This version prints the complete form.
We could just print the client portion of the form with no "chrome" or design a custom output form and print that. It will all be very similar to using MSAccess to generate a fancy filled in form. A little extra code and we could print pages of data records on separate documents. We can even convert to PDF if you have Office 2016 installed or have installed PDF support in Office 2010.
Here is the demo form. It has both "Preview" and "Print" buttons. The code can be added to any form and it will print the form. Maybe I will create a custom control set later or you could easily do it yourself off of this demo.
See the MS documentation for the two controls for printing and print preview. They are very rich with adjustments to the resulting dialogs and behaviors.
[System.Drawing.Printing.PrintDocument] https://msdn.microsoft.com/en-us/librar ... .110).aspx
[/url][/url][System.Windows.Forms.PrintDialog] https://msdn.microsoft.com/en-us/librar ... .110).aspx
[System.Windows.Forms.PrintPreviewDialog] https://msdn.microsoft.com/en-us/librar ... .110).aspx
This issue came up a few years ago and I had to apply my knowledge of printing in C# to PS. I found the old form (it was still a V1 PFF file) and cleaned up the code to make a simple demo of how to print the form on the screen to a printer. This version prints the complete form.
We could just print the client portion of the form with no "chrome" or design a custom output form and print that. It will all be very similar to using MSAccess to generate a fancy filled in form. A little extra code and we could print pages of data records on separate documents. We can even convert to PDF if you have Office 2016 installed or have installed PDF support in Office 2010.
Here is the demo form. It has both "Preview" and "Print" buttons. The code can be added to any form and it will print the form. Maybe I will create a custom control set later or you could easily do it yourself off of this demo.
See the MS documentation for the two controls for printing and print preview. They are very rich with adjustments to the resulting dialogs and behaviors.
[System.Drawing.Printing.PrintDocument] https://msdn.microsoft.com/en-us/librar ... .110).aspx
[/url][/url][System.Windows.Forms.PrintDialog] https://msdn.microsoft.com/en-us/librar ... .110).aspx
[System.Windows.Forms.PrintPreviewDialog] https://msdn.microsoft.com/en-us/librar ... .110).aspx
- Attachments
-
- Demo-PrintDocument.psf
- (15.91 KiB) Downloaded 179 times
Re: How to use Powershell Forms to create and fill printable doc
For this type of project, I think I would generate an html report. This gives you the ability to do some formatting, place the output in a webbrowser control as a preview, then call the Print method to print the report. If you want to keep it, save as an html file.
Re: How to use Powershell Forms to create and fill printable doc
DevinL wrote:Unfortunately, this seems more like a scripting based question as opposed to a product specific question. If so, then this belongs in the Windows PowerShell or PowerShell GUIs forum so the community can help out with this.
That being said, they're going to need more information to go off of such as what you've got so far for your script, what you've tried and what kind of information exactly you're wanting to get about your PC's.
Are you referring to the Sapien forums or the regular Powershell forums, like TechNet?