My main issue is, running this C# line of code Console.WriteLine(Properties.Settings.Default.GreetingText); throws this exception :
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl).
When the process using that line of code is started with user "A" from a mapped drive created by user "SYSTEM".
Note that the mapped drive created by SYSTEM is showing an X (disconnected) in explorer, but is still accessible by all users. This shows most probably that what I am trying to do is not supported by Microsoft. I was running several processes (C# or Native) without any problem until we used that particular process with that C# line of code. We tried to remove the line of code, but other C# line of codes are causing a similar problem.
I was looking into changing how the "net use" is created to use a supported way, but my research led to think that net use is PER USER ... but with the exception of SYSTEM user.
If I could create a S: mapped drive with SYSTEM and the same mapped drive S: with the logged in user, this would solve my problem, but its apparently impossible since the S: drive is seen in some way by the logged user even if doing "NET USE" doesn't show the S: drive.
Is it possible to run this C# code on a mapped drive by SYSTEM user ?
How can this problem be solved without having to define another letter ? Having to support 2 drive letter would have a huge impact on the scripts running all the processes because some are running SYSTEM, others are running as the logged user.