can't get powershell commands to work
It seems almost every powershell command I try to use generates an error. I am entering the commands exactly as I see in the get-help -examples, but still get errors. Below is my attempt to run test-activesyncconnectivity
[PS] C:\Windows\system32>Test-ActiveSyncConnectivity -useautodiscoverforclientaccessserver $true -url
https://owa.domain.c
om/microsoft-server-activesync -MailboxCredential (get-credential
test2@domain.com)
Cannot process argument transformation on parameter 'ClientAccessServer'. Cannot convert value "True" to type "Microsof
t.Exchange.Configuration.Tasks.ServerIdParameter". Error: "Invalid cast from 'System.Boolean' to 'Microsoft.Exchange.Co
nfiguration.Tasks.ServerIdParameter'."
+ CategoryInfo : InvalidData: (:) [Test-ActiveSyncConnectivity], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Test-ActiveSyncConnectivity
[PS] C:\Windows\system32>Test-ActiveSyncConnectivity -clientaccessserver xcas-hub -url
https://owa.domain.com/microsoft-se
rver-activesync -MailboxCredential (get-credential
test2@domain.com)
The -URL and -ClientAccessServer arguments are mutually exclusive.
+ CategoryInfo : InvalidArgument: (:) [Test-ActiveSyncConnectivity], ApplicationException
+ FullyQualifiedErrorId : 7215AB83,Microsoft.Exchange.Monitoring.TestMobileSyncConnectivity
[PS] C:\Windows\system32>Test-ActiveSyncConnectivity -url
https://owa.domain.com/microsoft-server-activesync -MailboxCrede
ntial (get-credential test2@domain.com)
The Client Access server wasn't specified. You can use the UseAutodisoverForClientAccessServer parameter to use the Aut
odiscover service to locate the Client Access server or use the ClientAccessServer parameter to specify the Client Acce
ss server. Alternatively, you can run this task directly on a Client Access server.
+ CategoryInfo : ObjectNotFound: (:) [Test-ActiveSyncConnectivity], CasHealthMustSpecifyCasException
+ FullyQualifiedErrorId : AF88E6B4,Microsoft.Exchange.Monitoring.TestMobileSyncConnectivity
What the heck am I doing wrong? I've spent hours and seem to be making no progress.
Thanks.
April 7th, 2012 1:51pm
Do any of the EMS cmdlets work properly? Did they ever work? Maybe it is time to reboot the CAS servers?
Jim McBee - Blog - http://mostlyexchange.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2012 1:53pm
CAS server had only been up 4 days. I rebooted it anyway and still get the same errors as above.
So many of the powershell examples cause the "cannot process argument transformation" error.
April 7th, 2012 2:07pm
Hi @All,
sometime you have to put the $true directly behind the pram like this:
Test-ActiveSyncConnectivity -UseAutodiscoverForClientAccessServer:$true -MailboxCredential (Get-Credential)
Than it works!
ArneArne Tiedemann | Active Directory and Exchange specialist
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2012 4:48pm
Hmmmm.
Why does the get-help -examples not show that?
Where is it documented? Why only "sometimes"?
How am I supposed to know when to use that syntax vs the one shown in get-help -examples?
Why does get-help Test-ActiveSyncConnectivity -examples, (on example 2) show both -UseAutoDiscoverForClientAccessServer and -URL on the same command when clearly it is an either/or situation?
Microsoft touts powershell as being designed especially for system administrators, but it seems like there are huge roadblocks to learning it; due to the errata in all the resources and documentation referencing it.
It is very frustrating.
April 7th, 2012 8:21pm
On Sun, 8 Apr 2012 00:14:55 +0000, adelatorre wrote:
>Hmmmm.
>
>Why does the get-help -examples not show that?
>
>
>
>Where is it documented? Why only "sometimes"?
When you're setting a "switch" it doesn't expect a parameter. Saying
"-switch 'foobar'" doesn't make sense, but "-switch:$true" or
"-switch:$false" does.
"[switch]" is a class
("System.Management.Automation.SwitchParameter"), just as "[string]",
"[object]", "[boolean]", etc. are classes.
These are both equivalent
-switch
-switch:$true
NOT providing the "-switch" at all is the equivalent of
"-switch:$false".
http://msdn.microsoft.com/en-us/library/system.management.automation.switchparameter(v=vs.85).aspx
"A switch parameter is a parameter that may, or may not, be specified
when the command is run. If the parameter is specified, the Windows
PowerShell runtime resolves its value as true. If the parameter is not
specified, which is typically the default, the parameter value is
resolved as false."
>How am I supposed to know when to use that syntax vs the one shown in get-help -examples?
Always use the ":" form to set the value of a switch and you'll never
be wrong.
FYI, you can ALWAYS use a ":" to separate a parameter and its value.
These both work:
-foo:bar
-foo bar
Read this, too:
http://stackoverflow.com/questions/8525572/powershell-colon-in-commandlet-parameters
>Why does get-help Test-ActiveSyncConnectivity -examples, (on example 2) show both -UseAutoDiscoverForClientAccessServer and -URL on the same command when clearly it is an either/or situation?
>
>Microsoft touts powershell as being designed especially for system administrators, but it seems like there are huge roadblocks to learning it; due to the errata in all the resources and documentation referencing it.
Don't confuse cmdlets with the Powershell language. Don't assume that
all "help" is absolutely correct, just as you wouldn't assume that
about stuff you read in traditional paper books. That's why there are
always errata published after the fact.
>It is very frustrating.
Learning a new language always is.
Image learning English and trying to understand the meaning of this
simple sentence: POLISH THE POLISH FURNITURE. :-)
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2012 10:25pm
On Sun, 8 Apr 2012 00:14:55 +0000, adelatorre wrote:
>Hmmmm.
>
>Why does the get-help -examples not show that?
>
>
>
>Where is it documented? Why only "sometimes"?
When you're setting a "switch" it doesn't expect a parameter. Saying
"-switch 'foobar'" doesn't make sense, but "-switch:$true" or
"-switch:$false" does.
"[switch]" is a class
("System.Management.Automation.SwitchParameter"), just as "[string]",
"[object]", "[boolean]", etc. are classes.
These are both equivalent
-switch
-switch:$true
NOT providing the "-switch" at all is the equivalent of
"-switch:$false".
http://msdn.microsoft.com/en-us/library/system.management.automation.switchparameter(v=vs.85).aspx
"A switch parameter is a parameter that may, or may not, be specified
when the command is run. If the parameter is specified, the Windows
PowerShell runtime resolves its value as true. If the parameter is not
specified, which is typically the default, the parameter value is
resolved as false."
>How am I supposed to know when to use that syntax vs the one shown in get-help -examples?
Always use the ":" form to set the value of a switch and you'll never
be wrong.
FYI, you can ALWAYS use a ":" to separate a parameter and its value.
These both work:
-foo:bar
-foo bar
Read this, too:
http://stackoverflow.com/questions/8525572/powershell-colon-in-commandlet-parameters
>Why does get-help Test-ActiveSyncConnectivity -examples, (on example 2) show both -UseAutoDiscoverForClientAccessServer and -URL on the same command when clearly it is an either/or situation?
>
>Microsoft touts powershell as being designed especially for system administrators, but it seems like there are huge roadblocks to learning it; due to the errata in all the resources and documentation referencing it.
Don't confuse cmdlets with the Powershell language. Don't assume that
all "help" is absolutely correct, just as you wouldn't assume that
about stuff you read in traditional paper books. That's why there are
always errata published after the fact.
>It is very frustrating.
Learning a new language always is.
Image learning English and trying to understand the meaning of this
simple sentence: POLISH THE POLISH FURNITURE. :-)
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
April 8th, 2012 5:18am
Rich,
Thank you very much for taking the time to pen such a lucid and helpful reply.
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2012 4:39pm