Announcement

Collapse
No announcement yet.

Passing Credentials to a power shell script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing Credentials to a power shell script

    Hello,
    I have a powershell script that is being used to check the diskspace..but we have multiple domains and no trust.I want to run the same script by passing different credentials..Can you please guide me in the right path.

    Thanks In Advance!

  • #2
    Re: Passing Credentials to a power shell script

    Originally posted by schinni9 View Post
    Hello,
    I have a powershell script that is being used to check the diskspace..but we have multiple domains and no trust.I want to run the same script by passing different credentials..Can you please guide me in the right path.

    Thanks In Advance!
    Can you post your script?

    Typically I would do something like this if I required authentication:

    http://sqlblog.com/blogs/jamie_thoms...owershell.aspx

    Comment


    • #3
      Re: Passing Credentials to a power shell script

      Here's a good rundown of the different ways to work with credentials: http://social.technet.microsoft.com/...owershell.aspx
      Regards,
      Jeremy

      Network Consultant/Engineer
      Baltimore - Washington area and beyond
      www.gma-cpa.com

      Comment


      • #4
        Re: Passing Credentials to a power shell script

        And of course there is always the Get-Credential cmdlet.

        $cred = Get-Credential mycompany\administrator

        You can then use $cred as the value for a -Credential parameter

        Comment

        Working...
        X