Share via


Integrated Windows authentication in PowerShell script

Question

Thursday, November 7, 2013 10:33 AM

 I am connecting remote session through Invoke command which I have to pass credentials but I don’t

want save password in script file or disk or registry .

Is it possible to implement integrated windows authentication?

Note: I will be configure the script in schedule task is task schedule configure credentials will use to

connect to remote machine.

$s = New-PSSession -computerName OMIDCM077 -authentication credssp -configurationname microsoft.powershell32

-credential $cred

Here i will use service account to connect remote session .

All replies (12)

Thursday, November 7, 2013 8:47 PM ✅Answered

Maybe -Authentication CredSSP ?

Have a look on the link below:

http://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.authenticationmechanism(v=vs.85).aspx

Note: 

CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows



Thursday, November 7, 2013 10:58 AM

Please check this link

Regards Chen V [MCTS SharePoint 2010]


Thursday, November 7, 2013 11:07 AM

I have checked the link but the password will store in the disk

it must take integrated windows authentication by default that is my requirement .


Thursday, November 7, 2013 11:13 AM

Then you should use Enter-PSSession and need to enable remote feature in server. Let me know if that helps.

Regards Chen V [MCTS SharePoint 2010]


Thursday, November 7, 2013 11:18 AM

help Enable-PSRemoting -example
help Enter-PSSession -example

The above commands will lead you!!!

Regards Chen V [MCTS SharePoint 2010]


Thursday, November 7, 2013 11:58 AM

No I have to use New-PSSession .


Thursday, November 7, 2013 12:19 PM

Think about security implications. If you are fine with hard coding the password

 $pw = convertto-securestring -AsPlainText -Force -String "PASSWORD"
 $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "DOMAIN\USERID",$pw
 $session = new-pssession -computername "SERVERNAME "-credential $cred
 $session

Regards Chen V [MCTS SharePoint 2010]


Thursday, November 7, 2013 1:13 PM

I am looking integrated windows authentication .


Thursday, November 7, 2013 1:31 PM

I am not sure. Just try this

New-PSSession -ComputerName ServerName -Authentication NegotiateWithImplicitCredential

Regards Chen V [MCTS SharePoint 2010]


Monday, November 11, 2013 1:54 AM

Hi,

Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.

TechNet Subscriber Support

If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here

Regards, Yan Li


Monday, November 11, 2013 11:24 AM

Currently I am using CreditSSP but password should pass

Is there any way to read password from schedule task configuration or SSO or windows authentication


Wednesday, November 13, 2013 2:19 AM

Hi,

For the last question, it seems like that you have opened new thread here:

http://social.technet.microsoft.com/Forums/windowsserver/en-US/2cfde21a-036b-4bdf-a9a5-420d42dbbb36/passing-password-in-powershell-script?forum=winserverpowershell#2cfde21a-036b-4bdf-a9a5-420d42dbbb36

Would you mind me closing this thread?

Regards,

Yan Li

Regards, Yan Li