Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Running a powershell script in VB with custom variables

Posted on 2011-09-02
1
Medium Priority
?
200 Views
Last Modified: 2012-05-12
I have a script i run to query our exchange 2010 server in powershell,for me this is fine as i can ammend the code as i need etc, however some people in the org could use this feature but wouldnt have a clue where to begin.

Basically i want to be able to design i simple form in Visual Basic express 2010 which will have text boxes such as "Email Address" and drop down boxes that they can select the information they would like to recieve, and a few other things like date ranges etc.

However i then want them to be able to click a button and then it will build the script in VB and run it in powershell.

Is there an easy way to do this?

When it comes to VB.net however i am a complete novice, i have looked around the web and found a sample that can run a powershell file but i need to be able to dynamically update it as people select different reporting features.
0
Comment
Question by:CaptainGiblets
1 Comment
 
LVL 16

Accepted Solution

by:
Bryan Butler earned 2000 total points
ID: 36473085
You should be able to create the .ps1 file on the fly and then execute it.  Simply output the commands to the .ps1 file.  Here's a couple links that might help (not with creating the file, but using PS from VB....creating the file is the easy part)

http://social.msdn.microsoft.com/Forums/en/Vsexpressvb/thread/bdb25af6-4e59-49f3-a84d-224715b95a70

http://groups.google.com/group/microsoft.public.windows.powershell/browse_thread/thread/42d3a6addd93f4b8
0

Featured Post

WatchGuard Case Study: NCR

With business operations for thousands of customers largely depending on the internal systems they support, NCR can’t afford to waste time or money on security products that are anything less than exceptional. That’s why they chose WatchGuard.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question