Powershell ISE does not show Mapped drive in FIle Open

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Tony Wainwright Tony Wainwright 2 years, 7 months ago.

  • Author
    Posts
  • #15156
    Profile photo of Tony Wainwright
    Tony Wainwright
    Participant

    Hi

    Using PS4. If I open PowerShell ISE as a normal user I can go to File>Open and browse to a mapped drive I have to store my scripts in. If I open PowerShell ISE as Administrator, it only shows C:.

    I have a modified profile that set the location to this drive and can successfully run Get-ChildItem in both ISE's. This is set with the following:

    New-PSDrive -Name T -PSProvider FileSystem -Root "\\Lincoln\Data\Tony Wainwright" | Out-Null
    Set-Location T:\Scripts

    Also, is there a way I can right click a file in File Explorer (Windows 8) and Edit a .PS1 file ISE with Elevated privileges?

    Thanks
    Tony

  • #15157
    Profile photo of Mike F Robbins
    Mike F Robbins
    Participant

    I'm guessing that your normal user account isn't an admin on the machine and UAC (User Access Control) is enabled. That means when you run the ISE as an admin you're prompted for the credentials of an admin on the machine and it's that account's network drives that you're seeing at that point instead of your normal user accounts mapped drives which is why you don't see any mapped drives since drive mapping are on a per user basis. You could either make your normal user a local admin on the machine or map the same drives as the user that your running PowerShell as when you're running PowerShell as an admin.

  • #15158
    Profile photo of Tony Wainwright
    Tony Wainwright
    Participant

    Hi Mike,

    Thanks – it's sorted.

You must be logged in to reply to this topic.