Powershell cannot switch to network drive CMD can ?? Powershell gurus please


jimbo45

Well-known member
Power User
VIP
Local time
6:38 PM
Posts
1,473
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
Hi folks
I've a network drive which in Windows is connected as Drive Z

In cmd I can switch to directory Z:\ and operate on it

In powershell I'm just trying to list the directory on it but doesn't recognixe the "Z" drive.

Same if I use set location Z:

Any way round this or have I got the wrong command :


Skjámynd 2022-03-22 105133.png


Cheers

jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

barman58

Moderator
Staff member
Local time
7:38 PM
Posts
1,093
OS
Windows 10 Pro x64 [Latest Release Preview]
I think PS requires you to assign a drive letter to a physical drive within the PS environment Not my strong suit but this may help you

 

My Computers

System One System Two

  • OS
    Windows 10 Pro x64 [Latest Release Preview]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Chillblast to my design
    CPU
    Ryzen 9 5950X, 4.9GHz
    Motherboard
    Asus Prime X570-Pro Motherboard
    Memory
    64GB DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti - HDMI, DP
    Sound Card
    On motherboard Feeding SPDiF 5.1 system
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Chillblast Silent Workstation PC Case - Black
    Cooling
    NZXT Kraken X63 280mm CPU Cooler, Quiet Case fans Fan
    Keyboard
    Wireless Logitec MX Keys + K830 [Depending on where I'm Sat]
    Mouse
    Wireless Logitec - MX Master 3 + M570 Trackball
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021
    Other Info
    Also run...
    Laptop - Quad 8GB - Windows 10 Pro x64 HP 15.2"
    Nexus 7 Android tablet [x2]
    Samsung 10.2" tablet
    Blackview 10.2 Tablet
    Sony Z3 Android Smartphone
    Samsung S9 Plus Smartphone
    Samsung Note S20
    Wacom Pro Medium Pen Pad
    Wacom Pro Small Pen Pad
    Wacom ExpressKey Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
  • Operating System
    Windows 10 Pro x64 [Latest release]
    Computer type
    Laptop
    Manufacturer/Model
    Dell XPS 17 9700
    CPU
    i7 10750H
    Motherboard
    Stock
    Memory
    32 GB
    Graphics card(s)
    Stock Intel + GTX 1650 Ti
    Sound Card
    Stock 4 speaker
    Monitor(s) Displays
    Stock 17"
    Screen Resolution
    3840 x 2160 HDR touchscreen
    Hard Drives
    2TB M2 NVMe
    PSU
    Stock
    Case
    Stock Aluminium / Carbon Fibre
    Cooling
    Stock + 2 fan cooling pad
    Mouse
    Stock Trackpad +Logi Mx Master 3
    Keyboard
    Stock Illuminated + Logi - MX Keys
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021

jimbo45

Well-known member
Power User
VIP
Thread Starter
Local time
6:38 PM
Posts
1,473
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
I think PS requires you to assign a drive letter to a physical drive within the PS environment Not my strong suit but this may help you

Hi there
I need this as part of a script -- it's fine for "Local" disks but seems to fail for Network drives.

I'm trying to get a quick way of loading folder and file names with some attributes into some type of text file -- the Power Query in EXCEL takes a bit long when you've got HDD's of several TB's and want file details. !!! I'm tring to clear some big network shared drives so I thought using a powershell script would be quick and easy -- EXCEL powerquery can take around 15 mins if there's a load of data !! Or longer in the case of this -- I interrupted it after 25 mins just copying the TEXT -- no data loading from the query.



For example - this one has over 36,000 entries

Skjámynd 2022-03-22 114924.png


I like EXCEL but doing this sort of stuff on a fairly low specced laptop isn't always the best of fun !!!! (Anybody got a spare CRAY lying around please !!!).

The output is great in EXCEL but needs to be done in smaller chunks !!

I've just about the patience on this laptop to do it in around 12,000 rows at a time -- I don't know who codes how these queries work in EXCEL but I'm sure the coding could be done more efficiently though. Nothing else matches the convenience of this but Ms seems to make it hideously hard for people do do this task . I can't be the only one around "Tidying up disks" !!! especially large network shared ones. You can also add attributes like created by / owner as well which is useful in deciding what to get rid of.


Skjámynd 2022-03-22 120326.png

Cheers

jimbo
 
Last edited:

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

A Guy

Righteous Dude
Power User
VIP
Local time
11:38 AM
Posts
1,167
Location
No matter where you go, there you are
OS
Windows 10 Home x64

My Computers

System One System Two

  • OS
    Windows 10 Home x64
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom
    CPU
    INTEL Core i5-11400
    Motherboard
    ASUS PRIME H570-PLUS
    Memory
    KINGSTON HyperX Fury Black DDR4 16GB (2 x 8GB) 3200MHz, CL16
    Graphics Card(s)
    EVGA GeForce GTX 750 Superclocked 1GB 128-Bit GDDR5
    Monitor(s) Displays
    LG 32MA68HY 32" IPS
    Screen Resolution
    1920 x 1080
    Hard Drives
    SAMSUNG 250GB 970 EVO Plus NVMe, M.2 SSD, Crucial 250GB MX500, SEAGATE 500GB Barracuda® 7200.12, SATA 3 Gb/s, 7200 RPM, 16MB cache
    PSU
    CORSAIR RM550x 80 PLUS Gold 550W
    Case
    ANTEC P10 FLUX
    Cooling
    be quiet! Pure Rock 2, 5 x 120 mm Case Fans
    Internet Speed
    480 + Mbps Up/ 12+ Mbps Down
    Browser
    Vivaldi Snapshot
    Antivirus
    Avast
  • Operating System
    Windows 10 Home x64
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom
    CPU
    Intel Core i5-750
    Motherboard
    ASUS P7P55D
    Memory
    Kingston HyperX Fury Black 8GB (2x4GB) DDR3-1600MHz CL8
    Graphics card(s)
    MSI GeForce GT 240 N240GT-MD1G/D5 1 GB DDR5
    Monitor(s) Displays
    LG 32MA68HY 32" IPS
    Screen Resolution
    1980x1040
    Hard Drives
    Samsung Electronics 840 EVO 120GB, SEAGATE 500GB Barracuda® 7200.12, SATA 3 Gb/s, 7200 RPM, 16MB cache
    PSU
    Antec TruePower New TP-550 550W
    Case
    Antec 300
    Cooling
    Cooler Master Hyper 212+, 4 Noctua NF-P12 120mm, 1 Noctua NF-P14 FLX
    Internet Speed
    480+ Mbps Down/12+Mbps Up
    Browser
    Vivaldi Snapshot
    Antivirus
    Avast

jimbo45

Well-known member
Power User
VIP
Thread Starter
Local time
6:38 PM
Posts
1,473
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
Try running Powershell not elevated , try running it without Run as administrator


A Guy
Thanks !!

seems bonkers to me as I'm doing stuff I wouldn't want an ordinary user to be on !!! Maintaining and tidying up networked shared drives.

Cheers
jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

Berton

Well-known member
Member
VIP
Local time
12:38 PM
Posts
563
Location
Wyoming
OS
Win11 Pro RTM x64
I see the same issue in Win11 Pro using the 'new' Terminal as Administrator in not seeing my NAS but Command Prompt works to show my NAS.

1647957014263.png
 

My Computers

System One System Two

  • OS
    Win11 Pro RTM x64
    Computer type
    Laptop
    Manufacturer/Model
    Dell Vostro 3400
    CPU
    Intel Core i5
    Memory
    8GB
    Hard Drives
    256GB SSD NVMe
  • Operating System
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Vostro 5890
    CPU
    Intel Core i5
    Memory
    8GB [16GB on order]
    Monitor(s) Displays
    21"
    Hard Drives
    512GB SSD NVMe
    Browser
    Firefox, Edge
    Antivirus
    Windows Defender/Microsoft Security
Top Bottom