How to run a exchange powershell script in silent moder?

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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You might try changing the value of the second parameter in that line:
maybe a 0 will do it?
Try to use the 0 parameter on the line.

Example:"notepad.exe", 0, True);

The 0 parameter should run the command in a hidden window.  The true parameter will wait for the command to complete.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
itsme_asifAuthor Commented:
Thanks very much. adding 0, did the trick.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.