Hi,
You can use the "-Credential" parameter to specify the admin account for some cmdlets like "Install-Module". For those without the "-Credential" parameter you can
start another PowerShell process as administrator
Start-Process -FilePath "powershell" -Verb RunAs
https://learn.microsoft.com/zh-cn/powershell/module/Microsoft.PowerShell.Management/Start-Process
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.