I was only using write-host as a bug check. I actually need to perform
operations on $myvar based on its contents. At the moment the mailbox I'm
pointing it to (my own) has autoreplystate disabled but when I do:
if ($state eq "enabled"){do this code}
it executes the code. That's why I put the write-host in, to check the value.
But changing that to $myvar.autoreplystate did the trick.
I swear... sometimes I assign values to vars and get the value. Sometimes I get
this @{ stuff (collection?) and I don't see a rhyme or reason to it. I did just
learn something though so thanks!
From: [email protected]
To: [email protected]
Subject: RE: [powershell] @{??
Date: Tue, 3 Feb 2015 00:31:07 +0000
Just tested this,
write-host $myvar.autoreplystate did the trick
Cheers
From: [email protected] [mailto:[email protected]]
On Behalf Of Damien Solodow
Sent: Tuesday, 3 February 2015 11:25 AM
To: [email protected]
Subject: RE: [powershell] @{??
Write-Host is brain dead. If you use write-object in your code block it returns
what you'd expect.
If you do write-host $myvar.autoreplystate it also returns what you'd expect.
Seriously though, don't use write-host. It kills kittens.
DAMIEN SOLODOW
Systems Engineer
317.447.6033 (office)
317.447.6014 (fax)
HARRISON COLLEGE
From:
[email protected] [[email protected]] on behalf of
Daniel Chenault [[email protected]]
Sent: Monday, February 02, 2015 7:11 PM
To: [email protected]
Subject: [powershell] @{??
Exchange-specific cmdlet but the actual question is more generic
$myvar = get-mailboxautoreplyconfiguration -identity <alias> | select-object
autoreplystate
write-host $myvar
outputs: @{Autoreplystate=disabled}
Why does $myvar get populated with that instead of just "Disabled"? I've been
searching and maybe I"m just using the wrong search terms but I'm getting
bupkes as an explanation for this or how to get only the value.
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1
++++++++++++++++++++++++++++++++++++++++++++++++
The information contained in this communication is strictly confidential and
intended solely for the use of the intended recipient(s). The copyright in this
communication belongs to ITG Australia Ltd, ITG Hong Kong Limited, ITG
Singapore Pte Ltd and/or their related entities, including Investment
Technology Group, Inc., (collectively referred to as “ITG") and may contain
information that is private, confidential or subject to legal professional or
other privilege. No confidentiality or privilege is waived or lost by any
mis-transmission of this email.
Access to this email by anyone other than the intended recipient is
unauthorized and further distribution of this email is strictly prohibited
without the permission of ITG. If you are not the intended recipient of this
email, any review, disclosure, copying, distribution, retention or any action
taken or omitted to be taken in reliance on it is prohibited and may be
unlawful. If you are not the intended recipient of this email, you should not
disseminate, distribute or copy this e-mail and you should delete it and all
copies of it from your system, destroy any hard copies of it and notify the
sender. ITG and/or its affiliates reserve the right to monitor and archive all
electronic communications through its/their network.
The information contained in this email is believed to be accurate at the time
of publication. However, ITG disclaims all responsibility for any loss or
damage howsoever arising as a result of any person or entity acting upon the
information contained in this email and no liability will be accepted by ITG
for any such loss or damage. Any views expressed in this email are those of the
individual sender, except where the email states otherwise and the sender is
authorized to state them to be the views of ITG.
++++++++++++++++++++++++++++++++++++++++++++++++
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1