KaustubhK
KaustubhK

Reputation: 775

Enter remote machine with administrative rights

I want to create PSSession on remote machine with administrative rights,anyone knows how to do that.

I have notices even i know administrative credentials, and using same while creating a PSSession, don't let me execute some commands on that remote machine.

I have searched, and found even using administrator credentials at PSSession don't create my session as administrator.

any idea how to do that or even how to switch session?

Upvotes: 1

Views: 419

Answers (1)

Jan Chrbolka
Jan Chrbolka

Reputation: 4454

This is a very good question.

Your problem, as you probably know, is caused by having UAC turned on, on the remote machine. This means, that even though you are running PowerShell session as user who is a member of the Administrators group, your PowerShell session is not executed with elevated privileges.

If you execute a script localy on the server, there is a way to automatically elevate privileges within the script. This is explained here. A self elevating PowerShell script

Unfortunately for you, this still creates a popup prompt for user to accept the privilege elevation. This makes it completely useless for remote execution.

I know that a lot of people will probably disagree, but the best (and possibly only) solution is to turn UAC off on the target machine.

Upvotes: 1

Related Questions