I found numerous threads and went through them but none of them really adressed my issue. I try to keep it short.
New-PSDrive –Name "G" –PSProvider FileSystem –Root "\\dom\dfs\dom-loc-Share" –Persist
It works perfectly fine if I run it from the ISE.
It works fine when I copy paste it to the console.
It does not work if I try running the ps1 in the console.
- I restarted the ISE
- I checked and both run in Single Threaded Apartment
- Executionpolicy is unrestricted
- I run both as administrator
Can you please help me?
-Scope Global, for more information visit this technet article:
Windows PowerShell protects access to variables, aliases, functions,
and Windows PowerShell drives (PSDrives) by limiting where they can be
read and changed. By enforcing a few simple rules for scope, Windows
PowerShell helps to ensure that you do not inadvertently change an
item that should not be changed. […]
New-PSDrive –Name "G" –PSProvider FileSystem –Root "\\dom\dfs\dom-loc-Share" –Persist -Scope Global