Passing credential for remote local account to Powershell function RRS feed

  • Question

  • We have begun to use Microsoft TFS Release Management server to deploy code to our development's and QA's test servers. However, due to our current procedure, these development's and QA's test server are standalone and due to the nature of our application, we will change the system time on these servers. Change the system time has created an issue with Release Management's Deployment Agents. So I'm trying to write a Powershell script to reset the time.

    I've had to use WMI to connect the server, as were still using Windows 2003 and 2008 OS on our servers, and manage to get this work interactively. But I want to remove the username and password in the Poweshell script and pass them as a credential parameter to the script.

    All the examples I've seen of passing credential as a parameter reference a domain username and password. But I can't find a reference for passing a local account i.e. ".\username". 

    Is it possible to pass a local account credential as a parameter to a Powershell script/function? 

    Tuesday, December 13, 2016 12:54 AM


All replies

  • localserveranme\account

    A server/workstaion is a domain when not joined to a domain.


    Tuesday, December 13, 2016 1:56 AM
  • We set up a set of servers to replicate our production systems, and we can have several of these set of servers. Since these servers are standalone and are connect to the same network segment, each server name has to be different. With your solution means, I can't create a credential that will work on more than 1 server. i.e. "One credential to rule them all" :).
    Thursday, December 15, 2016 9:15 PM
  • for a local account use LOCALHOST\Administrator


    Thursday, December 15, 2016 9:18 PM
  • Thanks for the reply. Although I was initial reluctant to having to create a credential for each server I want to connect to. I found that the alteration to my Powershell control script would be simple, i.e. I had the ComputerName in a variable, so no big deal to simple add the variable to the username string.

    Thanks for your help.

    Friday, December 16, 2016 10:36 PM