none
Get-ChildItem with UNC path RRS feed

  • Question

  • I have searched all over, but cannot find what's wrong with the following:

    PS C:\> Get-ChildItem -Path "\\HANNIBAL\C:\"
    Get-ChildItem : Cannot find path '\\HANNIBAL\C:\' because it does not exist.
    At line:1 char:1
    + Get-ChildItem -Path "\\HANNIBAL\C:\"

    PS C:\> Get-ChildItem -Path "C:\"  works fine. The machine name is HANNIBAL in both cases.

    Just FYI

    PS C:\> $PSversionTable.PSversion

    Major  Minor  Build  Revision
    -----  -----  -----  --------
    5      1      17134  165

    Any help will be much appreciated. TIA - joe



    • Edited by jbm417 Wednesday, July 25, 2018 6:13 PM
    Wednesday, July 25, 2018 6:09 PM

Answers

  • If you want to access the administrative share on a remote server you have to replace the colon with a dollar sign like this:
    Get-ChildItem -Path "\\HANNIBAL\C$"


    Best regards,

    (79,108,97,102|%{[char]$_})-join''

    Wednesday, July 25, 2018 6:25 PM

All replies

  • If you want to access the administrative share on a remote server you have to replace the colon with a dollar sign like this:
    Get-ChildItem -Path "\\HANNIBAL\C$"


    Best regards,

    (79,108,97,102|%{[char]$_})-join''

    Wednesday, July 25, 2018 6:25 PM
  • Thanks - this worked & got me on the right track  -- Joe
    Wednesday, July 25, 2018 9:33 PM