Avatar of Member_2_6492660_1
Member_2_6492660_1
Flag for United States of America asked on

invoke-command from Cent OS 7.4 to Windows 2012 R2 Access Denied

PS /tmp> invoke-command -Computername tgcs010 {get-process} -credential administrator

PowerShell credential request
 Enter your credentials.
 Password for user administrator: ********

invoke-command : MI_RESULT_ACCESS_DENIED
 At line:1 char:1
•invoke-command -Computername tgcs010 {get-process} -credential admini ...


•CategoryInfo : InvalidOperation: (:) [Invoke-Command], PSInvalidOperationException
•FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.InvokeCommandCommand

PS /tmp>

MY Version running on CENT OS 7.4

PS /tmp> $PSVersionTable

Name Value


PSVersion 6.0.0-rc.2
 PSEdition Core
 GitCommitId v6.0.0-rc.2
 OS Linux 3.10.0-693.11.1.el7.x86_64 #1 SMP Mon D...
 Platform Unix
 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
 PSRemotingProtocolVersion 2.3
 SerializationVersion 1.1.0.1
 WSManStackVersion 3.0

On my Windows 10 computer same command works

I domain joined the Cent OS server to my Windows Domain also.

What am I missing?

Thank you
PowershellWindows Server 2012Unix OS

Avatar of undefined
Last Comment
Member_2_6492660_1

8/22/2022 - Mon
Jose Gabriel Ortega Castro

You are using "administrator" that should be "domain\administrator":
try:
invoke-command -Computername tgcs010 {get-process} -credential "domain\administrator"

Open in new window

try again with your domain credentials.
Member_2_6492660_1

ASKER
Same results

PS /root> Invoke-command -computername tgcs011 {get-process} -Credential "our\administrator"

PowerShell credential request
Enter your credentials.
Password for user our\administrator: ********

Invoke-command : MI_RESULT_ACCESS_DENIED
At line:1 char:1
+ Invoke-command -computername tgcs011 {get-process} -Credential "our\a ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Invoke-Command], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.InvokeCommandCommand


Thoughts?
Jose Gabriel Ortega Castro

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Member_2_6492660_1

ASKER
Jose,

Powershell remoting in on in all my Windows servers

From my Windows 10 computer I can invoke-command and enter-possession to any server in any domain.

Just not from the Cent OS machine.

How do I enable psremoting on Cent OS?

 Been on GritHub site could not find anything there either.



On CENT OS

PS /root> enable-psremoting
enable-psremoting : The term 'enable-psremoting' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ enable-psremoting
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (enable-psremoting:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException


Any ideas?
ASKER CERTIFIED SOLUTION
Qlemo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jose Gabriel Ortega Castro

So in resumen:

Invoke-command -computername tgcs011 {get-process} -Credential "our\administrator"  -Authentication Basic (-Authentication Negotiate.)

Open in new window


(I didn't know about the psremoting on unix). Either way, as Qlemo said it's only in the "Target" OS not in the source one.
Member_2_6492660_1

ASKER
According to GitHub you need to use openssh on windows servers

sub -computername with -hostname

does any one have this working?

I can now ssh from my Cent OS 7.4 server to my Windows 2012 R2 server

but the invoke-command and enter-possession still do not work
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Qlemo

SSH is another way to remote connect, not the only one.
Member_2_6492660_1

ASKER
Having it working using ssh but that is not the method I need
Waiting for MS to fix this