net use via Powershell returning A specified logon session does not exist. It may already have been terminated error
i'm getting error when running net use command via powershell.
system error 1312 has occurred.
+ categoryinfo : notspecified: (system error 1312 has occurred.:s
tring) [], remoteexception
+ fullyqualifiederrorid : nativecommanderror
+ pscomputername : xxxxxxxxx
specified logon session not exist. may have been terminated.
the command running " powershell invoke-command -computername xxxxx {net use \\share /user:<domain>\<username> password} "
running net use locally on box runs fine without issues, same command using powershell remote execution causing command fail.
ps-remoting , configure-smremoting -enable have been run on remote box.
any ideas on how resolve issue?
please remember mark replies answers if thanks, --kuldeep
to work, must configure both local , remote computers.
on remote server, run following command:
enable-wsmancredssp -role server
you'll know things confgured correctly if run get-wsmancredssp
cmdlet , following output:
the machine not configured allow delegating fresh credentials. computer configured receive credentials remote client computer.
on local computer, administrative powershell prompt, need allow credential delegation in powershell. run following command:
enable-wsmancredssp -role client -delegatedcredentials <remote_computer_name>
you can enable servers using * remote_computer_name
.
you'll know configured correctly when run get-wsmancredssp , following output:
the machine configured allow delegating fresh credentials following target(s): wsman/remote_server_name
computer not configured receive credentials remote client computer.
on local machine, update group policy allow credentials delegated remote server.
1.open gpedit.msc , browse computer configuration > administrative templates > system > credentials delegation.
2.double-click "allow delegating fresh credentials ntlm-only server authentication".
3.enable setting , add build server server list wsman/buildservername. (you can enable servers entering wsman/*.)
then, when need run command on remote server, you can't use of *-pssession commands because credssp can't use cached credentials. have start session using invoke-command
, , use credssp value authentication parameter, so:
invoke-command -scriptblock { # remote commands here } `
-computername <remote_computer_name> `
-authentication credssp `
-credential <username>
Windows Server > Security
Comments
Post a Comment