Change object properties from get to get ; set

Posted on 2012-08-16
Last Modified: 2012-08-20
How do I change a property of an object from get only to get; set . Below is the sample code, I wish to change "clientcredentials" to be {get ; set } . Never quite picked up on this concept in powershell101.

$proxy |gm
     TypeName: ReservationInvoiceServiceClient

    Name                    MemberType Definition                                                                                                                                                   
    ----                    ---------- ----------                                                                                                                                                   
    Abort                   Method     System.Void Abort()                                                                                                                                         
    BeginClose              Method     System.IAsyncResult BeginClose(System.AsyncCallback callback, System.Object state), System.IAsyncResult BeginClose(System.TimeSpan timeout, System.AsyncCa...
    BeginOpen               Method     System.IAsyncResult BeginOpen(System.AsyncCallback callback, System.Object state), System.IAsyncResult BeginOpen(System.TimeSpan timeout, System.AsyncCall...
    Close                   Method     System.Void Close(), System.Void Close(System.TimeSpan timeout)                                                                                             
    DisplayInitializationUI Method     System.Void DisplayInitializationUI()                                                                                                                       
    Dispose                 Method     System.Void Dispose()                                                                                                                                       
    EndClose                Method     System.Void EndClose(System.IAsyncResult result)                                                                                                             
    EndOpen                 Method     System.Void EndOpen(System.IAsyncResult result)                                                                                                             
    Equals                  Method     bool Equals(System.Object obj)                                                                                                                               
    GetHashCode             Method     int GetHashCode()                                                                                                                                           
    GetReservation          Method    Company.Product.IWeb.ReservationResponse, 0ofr1eqk, Version=, Culture=neutral, PublicKeyToken=null GetReservation(Companys.Product.IWeb.Reservatio...
    GetType                 Method     type GetType()                                                                                                                                               
    Open                    Method     System.Void Open(), System.Void Open(System.TimeSpan timeout)                                                                                               
    ToString                Method     string ToString()                                                                                                                                           
    ChannelFactory          Property   System.ServiceModel.ChannelFactory`1[[IReservationInvoiceService, 0ofr1eqk, Version=, Culture=neutral, PublicKeyToken=null]] ChannelFactory {get;}   
    ClientCredentials       Property   System.ServiceModel.Description.ClientCredentials ClientCredentials {get;}                                                                                   
    Endpoint                Property   System.ServiceModel.Description.ServiceEndpoint Endpoint {get;}                                                                                             
    InnerChannel            Property   System.ServiceModel.IClientChannel InnerChannel {get;}                                                                                                       
    State                   Property   System.ServiceModel.CommunicationState State {get;}     

Open in new window

Question by:davesnb
    LVL 6

    Expert Comment

    Is this a custom object your creating / coding?

    Author Comment

    It is a web service , but I was told i could connect via

    WebServiceClient.ClientCredentials.UserName.UserName = "username";
    WebServiceClient.ClientCredentials.UserName.Password = "password";

    When i run it will attempt to pass the credentials, so appears the credential property needs to be get; set.

    So really two part question, with the goal of connecting to this webservice using the wcf web proxy functions i found on posh code.
    LVL 6

    Accepted Solution

    If its not a object you're creating, but rather one your loading, then you cannot change the get to a get;set. Thats defined at the object level.

    If you can provide some more context to the script your trying to pass these credentials to,
    I am sure we can get this sorted out for you.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
    I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now