troubleshooting Question

How to run a exchange powershell script in silent moder?

Avatar of itsme_asif
itsme_asif asked on
ExchangePowershellVB Script
3 Comments1 Solution1840 ViewsLast Modified:
Hi Experts,
I use a exchange powershell script which I call through an external Java program to create a mail box. The script works fine. However every time the script is called it the powershell window pops up until the script runs and closes automatically, This could be a problem when I would have call the exchange powershell script for 100 users at a given time to create mailboxes, as there will be 100 powershell windows opening and closing. I will attach the vb script below, appreciate if you can please provide a solution to it
' This Script is used for creating Mailboxes for Active Directory Users.
' This script triggers a Power Shell Script which creates the mailbox for the Active
' Directory User.
Set args = WScript.Arguments
' Argument 0 contains the Log On Name
Wscript.echo args.Item(0)
' Argument 1 contains the Mail Store Database Name
Wscript.echo args.Item(1)
' Argument 2 contains the Primary SMTP Address
Wscript.echo args.Item(2)
' Argument 3 contains the Report Log Path
Wscript.echo args.Item(3)
on error resume Next
dim shell
set shell=createobject("")
'Firing the Power Shell command from VB Script "PowerShell.exe -PSConsoleFile ""d:\Exchange Server\Bin\exshell.psc1"" -noexit ""&{""Enable-Mailbox '"&args.Item(0)&"' -Database '"&args.Item(1)&"' –PrimarySmtpAddress  '"&args.Item(2)&"'"";""exit 0""} 2>&1 >> "&args.Item(3)&"",,20
If Err.Number <> 0 Then 
      Wscript.Echo("Error Occurred " & Err.description)
End If 

Open in new window


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros