Solved

Running a powershell script in VB with custom variables

Posted on 2011-09-02
1
191 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 500 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
A procedure for exporting installed hotfix details of remote computers using powershell
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now