Exchange 2010 Power Shell and Cisco Unity Generated Scripts
I am trying to run some scripts that are generated by unity when trying to connect to Exchange 2010. The script that is generated is list below and the error is listed below that. I do not see where mailboxlist is a command in the shell.
Has anyone else encountered this?
This is the script
[PS] C:\Windows\system32>mailboxList = 'CN=EAdmin5a7d008b,OU=Unity,DC=lebanon-csd,DC=net' targetDatabase = 'CN=Users P-Z
,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Lebanon City Schools,CN=Mic
rosoft Exchange,CN=Services,CN=Configuration,DC=lebanon-csd,DC=net'$mailboxList | New-MoveRequest -targetDatabase:$targe
tDatabase[array]$inTransit = $mailboxList | Get-MoveRequest -ErrorAction SilentlyContinue | ?{ $_.Status -ne 'Failed'
-and $_.Status -ne 'Completed' -and $_.Status -ne 'CompletedWithWarning' }while ($inTransit){[array]$inTransit = $inTra
nsit | Get-MoveRequest -ErrorAction SilentlyContinue | ?{ $_.Status -ne 'Failed' -and $_.Status -ne 'Completed' -and $_.
Status -ne 'CompletedWithWarning' }}$mailboxList | Get-MoveRequest -ErrorAction SilentlyContinue | ?{ $_.Status -eq 'Com
pleted' } | Remove-MoveRequest -Confirm:$false -ErrorAction SilentlyContinue
This is the error.
Missing or invalid array index expression.
At line:1 char:346
+ mailboxList = 'CN=EAdmin5a7d008b,OU=Unity,DC=lebanon-csd,DC=net' targetDatabase = 'CN=Users P-Z,CN=Databases,CN=Excha
nge Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Lebanon City Schools,CN=Microsoft Exchange,CN=Se
rvices,CN=Configuration,DC=lebanon-csd,DC=net'$mailboxList | New-MoveRequest -targetDatabase:$targetDatabase[ <<<< arra
y]$inTransit = $mailboxList | Get-MoveRequest -ErrorAction SilentlyContinue | ?{ $_.Status -ne 'Failed' -and $_.Statu
s -ne 'Completed' -and $_.Status -ne 'CompletedWithWarning' }while ($inTransit){[array]$inTransit = $inTransit | Get-M
oveRequest -ErrorAction SilentlyContinue | ?{ $_.Status -ne 'Failed' -and $_.Status -ne 'Completed' -and $_.Status -ne
'CompletedWithWarning' }}$mailboxList | Get-MoveRequest -ErrorAction SilentlyContinue | ?{ $_.Status -eq 'Completed' }
| Remove-MoveRequest -Confirm:$false -ErrorAction SilentlyContinue
+ CategoryInfo : ParserError: ([:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingArrayIndexExpression Preston Thornhill pthornhill@fusionstorm.com
August 2nd, 2010 3:27am
On Mon, 2 Aug 2010 00:27:03 +0000, Preston T wrote:
>
>
>I am trying to run some scripts that are generated by unity when trying to connect to Exchange 2010. The script that is generated is list below and the error is listed below that. I do not see where mailboxlist is a command in the shell. Has anyone else
encountered this?
Is this something you keyed in at the command line? "mailboxList"
isn't a command, it's the name of a variable -- except it's missing
the leading "$".
The error, however lies in this part of that very long set of
activities:
. . . | New-MoveRequest
-targetDatabase:$targetDatabase[array]$inTransit = $mailboxList | .
.. ."
It looks like there's either a missing "|" or ";" between
"$targetDatabase" and "[array]". The missing punctuation leads
Powershell to treat the "[array]" as a subscript rather than as a
"cast" of the variable $inTransit as an array object.
If this is an exact copy of something provided by Cisco then it's time
to call Cisco and get the correct set of characters. If it's something
you've entered by hand then it's time to verify that what you entered
is exactly what Cisco proposed.
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2010 5:51am
That was an exact copy of what Cisco's script provided. ThanksPreston Thornhill pthornhill@fusionstorm.com
August 2nd, 2010 5:10pm
I recreated the scripts manualy and fixed the issues thanks.Preston Thornhill pthornhill@fusionstorm.com
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2010 6:55pm