I have a C# service that I am unable to modify running on Windows Server. Internally this service has a function that uses DriveInfo.GetDrives to get a list of available drives, returning that information to an API. However while this returns the C drive it fails to detect a drive mapped from another machine created via the following Powershell script:
$cred = Get-Credential -Credential myusername
New-PSDrive -Name "Z" -Root "\192.168.1.24SharedFolder" -Persist -PSProvider "FileSystem" -Credential $cred -Scope Global
Net Use
Read-Host -Prompt "Press Enter to exit"
I have tried creating new users with permission to access the drive and getting the service to log on as that user, changing permissions for the mapped drive as well as double checking that the following registry key existed (it did):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem]
"EnableLinkedConnections"=dword:00000001
However, nothing works. I created a simple C# application that uses DriveInfo.GetDrives and it returns both the C drive as well as the mapped Z drive. This is clearly some sort of permissions issue. What am I missing? Any help very much appreciated.