Powershell Server Network drive

前端 未结 2 1503
广开言路
广开言路 2021-01-24 17:55

I have a client and a server. The client will call a script like:

#Predefine necessary information
$Username = \"Niels\"
$Password = \"password\"
$ComputerName          


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-24 18:39

    Another option is to use a delegated session on your server.

    Basically, you create a custom remote session that uses the -RunAs parameter to designate the credentials that the session will run under. You can also constrain what scripts and cmdlets can be run in the session and specify who can connect to the session.

    In this case, the session would run as the Niels account, and everything done in the session would be under that account authority, regardless of who was connected to the session. From that session, you can now make one hop to another server without needing CredSSP.

    This also eliminates the security risk involved in storing that account password in the script file on the client computer.

    http://blogs.technet.com/b/heyscriptingguy/archive/2014/04/03/use-delegated-administration-and-proxy-functions.aspx

提交回复
热议问题