question

VinodSurvase-1595 avatar image
0 Votes"
VinodSurvase-1595 asked VinodSurvase-1595 commented

How to run powershell commands without admin rights? Is there any option we can use and achive this?

How to run PowerShell commands without admin rights? Is there any option we can use and achieve this?

office-teams-windows-itprowindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
1 Vote"
LimitlessTechnology-2700 answered VinodSurvase-1595 commented

Hello Vinod,

If your domain administrator hasn't forbidden it, you can do this:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

If you instead want to change the execution policy for just the current PowerShell session, you can use this command:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

However, if your domain administrator is using the "Turn on Script Execution" group policy, you will not be able to change your execution policy at all. The group policy setting makes the Set-ExecutionPolicy cmdlet ineffective.

--please don't forget to upvote and Accept as answer if the reply is helpful--

Thanks,

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @LimitlessTechnology-2700 , Thanks for your reply. I tried this but no luck. I am getting below error when I am trying to run MS teams PowerShell command without Run as admin on PowerShell.

Get-CsTeamsMessagingPolicy

Get-CsOnlineSession : Connecting to remote server api.interfaces.records.teams.microsoft.com failed with the following error message : The WinRM client cannot process
the request. Basic authentication is currently disabled in the client configuration. Change the client configuration and try the request again. For more information,
see the about_Remote_Troubleshooting Help topic.
At C:\Users\username\OneDrive -\Documents\WindowsPowerShell\Modules\MicrosoftTeams\2.5.1\net472\SfBORemotePowershellModule.psm1:273 char:22
+ $remoteSession = & (Get-CsOnlineSessionCommand)
0 Votes 0 ·

Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command
again.
At C:\Users\username\OneDrive - \Documents\WindowsPowerShell\Modules\MicrosoftTeams\2.5.1\net472\SfBORemotePowershellModule.psm1:113 char:38
+ -Session $session `
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand

0 Votes 0 ·
LeonLaude avatar image
0 Votes"
LeonLaude answered VinodSurvase-1595 commented

Hi @VinodSurvase-1595,

This may depend on your organization's policies, have a look here for a few options on how to run PowerShell commands without admin rights:
How do I run powershell scripts without admin rights?


If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!


Best regards,
Leon

· 14
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @LeonLaude , Thanks for your reply. I tried this but no luck. I am getting below error when I am trying to run MS teams PowerShell command without Run as admin on PowerShell.

>Get-CsTeamsMessagingPolicy
Get-CsOnlineSession : Connecting to remote server api.interfaces.records.teams.microsoft.com failed with the following error message : The WinRM client cannot process
the request. Basic authentication is currently disabled in the client configuration. Change the client configuration and try the request again. For more information,
see the about_Remote_Troubleshooting Help topic.
At C:\Users\username\OneDrive -\Documents\WindowsPowerShell\Modules\MicrosoftTeams\2.5.1\net472\SfBORemotePowershellModule.psm1:273 char:22
+ $remoteSession = & (Get-CsOnlineSessionCommand)

0 Votes 0 ·
  •                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : NotSpecified: (:) [Get-CsOnlineSession], PSRemotingTransportException
     + FullyQualifiedErrorId : PSRemotingTransportException,Microsoft.Teams.ConfigApi.Cmdlets.GetCsOnlineSession
    

Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command
again.
At C:\Users\username\OneDrive - \Documents\WindowsPowerShell\Modules\MicrosoftTeams\2.5.1\net472\SfBORemotePowershellModule.psm1:113 char:38
+ -Session $session `
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand


0 Votes 0 ·

It isn't that you don't have admin rights. The error is that you're trying to use BASIC authentication:

Basic authentication is currently disabled in the client configuration. Change the client configuration and try the request again. For more information,

see the about_Remote_Troubleshooting Help topic.
0 Votes 0 ·

Hi @RichMatheisen-8856 , Thanks for reply. I did try but it gives me an error
see below

Get-Help about_Remote_Troubleshooting
Get-Help : Get-Help could not find about_Remote_Troubleshooting in a help file in this session. To download updated help topics type: "Update-Help". To get help online,
search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At line:1 char:1
+ Get-Help about_Remote_Troubleshooting
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
+ FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

0 Votes 0 ·
Show more comments
LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered VinodSurvase-1595 commented

Hello Vinod,

Unfortunately it seems that the issue here is not with Script execution but also with the Basic Authentication settings on your tenant. Basic Authentication seems to be disabled from what is written in the output.

Not an expert in O365 or scripting to cloud services but I would suggest to check the tenant policies about Basic Authentication, and check by enabling 1 by 1 which is the one that is blocking the execution.

https://docs.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/disable-basic-authentication-in-exchange-online
In the part: Authentication policy procedures in Exchange Online

Hope that helps.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @LimitlessTechnology-2700 , As per my knowledge we don't have any policies on tenant like basic authentication but I need to check if we have any.

0 Votes 0 ·