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.
Can you please help me?
Use -Scope Global
, for more information visit this technet article:
about_Scopes https://technet.microsoft.com/en-us/library/hh847849.aspx
[...] 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With