UNC path syntax when remote system drive is not C:\

I have the following PowerShell code:

$Domain = "VM-PRO"
[string] $SystemDrive = Get-CimInstance -Class Win32_OperatingSystem -CimSession $CimServer |
Select-Object -ExpandProperty SystemDrive
$SystemDrive = $SystemDrive.TrimEnd(":")
$AppPath = "\\$Domain\$SystemDrive`$\Users\$User\AppData"
Test-Path $AppPath

Which works just fine, System drive on remote server is C:\ and AppPath expands to:

\\VM-PRO\C$\Users\User\AppData

My question is, what if system drive on remote computer is X:\ or something else? Wouldn't that result is non existent share? ex:

\\VM-PRO\X$\Users\User\AppData

What I'm asking, is default share C$ always C$ or does it depend on actual system drive letter?

1 Answer

It does depend on the actual drive letter.

By default, Windows creates the following admin shares:

  • Admin$ — Remote admin (this is the %SystemRoot% directory)
  • IPC$ — Remote IPC (used in named pipes)
  • C$ — Default Drive Share

If there are other partitions on the computer that are assigned a drive letter, they are also automatically published as admin shares (D$, E$, etc.).

If you are using a shared printer, there should be Print$; and FAX$ for a fax server.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like