Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - execute Exchange script from DOS - how to get result?

Reply
 
Old 01-31-2009   #1 (permalink)
Exchange2007-Q


 
 

execute Exchange script from DOS - how to get result?

how can I ran this script from a dos batch file and get the exit code?
the batch file suppose to do A if the DB is mounted and to do B if not

is-mounted.ps1 :
***********
PARAM ($ServerName)

$DBmount = Get-Mailboxdatabase -server $ServerName -status | where
{$_.Mounted -eq $false}

if ($DBmount -eq $null){"All DB are mounted";exit 1}
if ($DBmount -ne $null){"NOTnAll DB are mounted";exit 2}

My System SpecsSystem Spec
Old 02-02-2009   #2 (permalink)
rkd


 
 

RE: execute Exchange script from DOS - how to get result?

a quick and simple way could be to write the exit code in a plain file in
your TEMP-path and after that read that file from your batch.

"Exchange2007-Q" wrote:
Quote:

> how can I ran this script from a dos batch file and get the exit code?
> the batch file suppose to do A if the DB is mounted and to do B if not
>
> is-mounted.ps1 :
> ***********
> PARAM ($ServerName)
>
> $DBmount = Get-Mailboxdatabase -server $ServerName -status | where
> {$_.Mounted -eq $false}
>
> if ($DBmount -eq $null){"All DB are mounted";exit 1}
> if ($DBmount -ne $null){"NOTnAll DB are mounted";exit 2}
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
how to execute query which is use to truen result like pivot table .NET General
Permissions to execute the script VB Script
powershell script to execute simultaneously instead of sequentially PowerShell
Execute a powershell script from a webpage PowerShell
execute powershell script from commmand line PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46