Share via

Net use per user ?

Anonymous
2017-04-18T15:41:22+00:00

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.

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2017-04-19T13:34:08+00:00

    Was this answer helpful?

    0 comments No comments