Solved

Running a powershell script in VB with custom variables

Posted on 2011-09-02
1
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

734 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