How do I run my PowerShell script from a specific drive?

0
1
Asked By CuriousCat97 On

I'm new to PowerShell and trying to execute a script located at W:Skriptecreateuser.ps1. However, when I enter that path in the command line, it fails to work. When I check the path using the command "Test-Path W:Skriptecreateuser.ps1", it returns false. I'm hoping someone can help me figure this out so I can get my script running!

2 Answers

Answered By HelpfulHank99 On

It sounds like the issue might be related to user permissions. If you're opening PowerShell as a different user, that user might not have access to the W: drive. Make sure you're launching PowerShell normally and try the "Test-Path" command along with your script again.

Answered By TechieTommy22 On

Try running the command "Get-ExecutionPolicy" in PowerShell. The execution policy needs to be at least set to "RemoteSigned" for your script to work. You can find more details about running scripts here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scripts?view=powershell-7.5

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.