Solved

Running a powershell script in VB with custom variables

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
scanning dentists xray (the small ones) 3 43
SQL syntax in VB.net 5 29
Simple Q for someone 3 17
Get Client IP on RDS - VB.NET 15 25
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

24 Experts available now in Live!

Get 1:1 Help Now