Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to run a exchange powershell script in silent moder?

Avatar of itsme_asif
itsme_asif asked on
ExchangeVB ScriptPowershell
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("wscript.shell")
'Firing the Power Shell command from VB Script
shell.run "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)
             Wscript.quit(2)
End If 
Wscript.quit(3)
ASKER CERTIFIED SOLUTION
Avatar of martingagnon
martingagnonFlag of Canada image

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

Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers