![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Setting up Security with Powershell Hello All, I am writing one application to make GUI for powershell using vb .net. Here is my basic code. Dim myRunSpace As Runspace Dim rsConfig As RunspaceConfiguration rsConfig = RunspaceConfiguration.Create() Dim snapInException As New PSSnapInException Dim info As PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", snapInException) myRunSpace = RunspaceFactory.CreateRunspace(rsConfig) myRunSpace.Open() Dim cmd As Pipeline = myRunSpace.CreatePipeline() Dim myCommand As New Command(Me.TextBox1.Text) cmd.Commands.Add(myCommand) Dim results As Collection(Of PSObject) = cmd.Invoke Dim sb As New StringBuilder Me.ListBox1.Items.Add("Command: " + Me.TextBox1.Text) Me.ListBox1.Items.Add(" ") For Each cmdlet As PSObject In results Dim cmdletName As String If cmdlet.Properties("Name") Is Nothing Then Me.ListBox1.Items.Add(cmdlet.ToString()) Else cmdletName = cmdlet.Properties("Name").Value.ToString() ' & vbCrLf & cmdlet.Properties("PSVersion").Value.ToString() & vbCrLf & cmdlet.Properties("Description").Value.ToString() Me.ListBox1.Items.Add(cmdletName) Me.ListBox1.Items.Add(" ") End If cmdletName = cmdlet.Properties("Name").Value.ToString() ' & vbCrLf & cmdlet.Properties("PSVersion").Value.ToString() & vbCrLf & cmdlet.Properties("Description").Value.ToString() Me.ListBox1.Items.Add(cmdletName) Me.ListBox1.Items.Add(" ") Next When I run any cmdlet like get-command or get-process, I am able to get the results. I want to include all major functionality for Exchange Server. Now here the problem comes, Whenever i am trying to execute the Exchange Server cmdLet like New-AddressList or New- MailBox, It gives me message saying the Term is not recognized. But if i just write the command name like (New-AddressList), I am getting message saying I am missing the parameter which should be supplied with it. It makes sense that the Exchange Snap in and command is available but some security is preventing me to run that. Please help me. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Setting up Security with Powershell Quote: > When I run any cmdlet like get-command or get-process, I am able to > get the results. I want to include all major functionality for > Exchange Server. Now here the problem comes, Whenever i am trying to > execute the Exchange Server cmdLet like New-AddressList or New- > MailBox, It gives me message saying the Term is not recognized. But > if i just write the command name like (New-AddressList), I am getting > message saying I am missing the parameter which should be supplied > with it. It makes sense that the Exchange Snap in and command is > available but some security is preventing me to run that. > > Please help me. loaded. Are you calling this VB.NET code from ASP.NET by any chance? Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Setting up Security with Powershell Thanks Marco, I ran that and Exchange snap in was there. Actually the problem was in the code, when i was sending the New- AddressList -Name "Rak****", the program was trying to parse whole " New-AddressList -Name "Rak****" ", this as one command. while the command is New-AddressList and -Name is the parameter to that. So i used CommandParameter class, and it worked fine. Yeah, I am making this application which will be available on Web through asp .net. Rak**** |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Setting share permissions from PowerShell? | PowerShell | |||
| Re: Security Setting to allow activex | Vista security | |||
| Security Setting are Maddening | Vista security | |||
| Re: Security Setting | Vista security | |||
| Setting a WMI Namespace security descriptor with WMI/PowerShell | PowerShell | |||