I away use PowerGUI to write and specially to debug. It works great for me.

Cesar
On Feb 3, 2015 6:03 PM, "Daniel Chenault" <dani...@hotmail.com> wrote:

> Thank you, Gavin. A clear, succinct explanation that cleared my confusion.
>
> On Feb 3, 2015, at 14:01, "Liu, Gavin" <gavin....@nordstrom.com> wrote:
>
>  Part of the confusion is due to the fact that powershell is not strong
> typed so variables change to be what you need them to be. When you use the
> Select-Object cmdlet in your example code you are then storing the PROPERTY
> Autoreplystate from Get-mailboxautoreplyconfiguration. This property of
> autoreplystate has a VALUE of Disabled. If you were to instead write:
>
>
>
> $myvar = (get-mailboxautoreplyconfiguration -identity <alias> |
> select-object autoreplystate).autoreplystate
>
> write-host $myvar
>
>
>
> Now $myvar should be “Disabled” because you are storing the value of
> autoreplystate from the function get-mailboxautoreplyconfiguration
>
>
>
>
>
> Gavin
>
>
>
> *From:* listsad...@lists.myitforum.com [
> mailto:listsad...@lists.myitforum.com <listsad...@lists.myitforum.com>] *On
> Behalf Of *Daniel Chenault
> *Sent:* Monday, February 2, 2015 4:48 PM
> *To:* powershell@lists.myitforum.com
> *Subject:* RE: [powershell] @{??
>
>
>
> 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: carol.os...@itg.com
> To: powershell@lists.myitforum.com
> Subject: RE: [powershell] @{??
> Date: Tue, 3 Feb 2015 00:31:07 +0000
>
> Just tested this, write-host $myvar.autoreplystate did the trick
>
>
>
> Cheers
>
>
>
> *From:* listsad...@lists.myitforum.com [
> mailto:listsad...@lists.myitforum.com <listsad...@lists.myitforum.com>] *On
> Behalf Of *Damien Solodow
> *Sent:* Tuesday, 3 February 2015 11:25 AM
> *To:* powershell@lists.myitforum.com
> *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:* listsad...@lists.myitforum.com [listsad...@lists.myitforum.com]
> on behalf of Daniel Chenault [dani...@hotmail.com]
> *Sent:* Monday, February 02, 2015 7:11 PM
> *To:* powershell@lists.myitforum.com
> *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
>
> ================================================
> 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


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to