locked
Windows 8 and msg.exe System.Security.SecurityException RRS feed

  • Question

  • I have a desktop application that uses msg.exe to occasionally send alerts to users of the application.  On all Windows 7 PC's where the application is installed, the following code works:

                           

    AppDomain.CurrentDomain.SetPrincipalPolicy(Security.Principal.PrincipalPolicy.WindowsPrincipal)

                           

    DimprincipalPerm AsNewPrincipalPermission(Nothing, "Administrators")

                            principalPerm.Demand()

                           

    Dimproc AsNewProcessStartInfo("msg.exe")

                            proc.WorkingDirectory =

    Environment.SystemDirectory

                            proc.Arguments =

    "* /SERVER:"+ strComputerName + " /TIME:28800 "+ strAlert '8 hours


                            proc.CreateNoWindow =

    True


                            proc.UseShellExecute =

    False


                           

    Process.Start(proc)

    However, on Windows 8 PC's, the above code generates an exception: "Application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission, contact your system administrator, or use the Microsoft.NET Framework Configuration tool."

    Exception Source:      mscorlib

    Exception Type:        System.Security.SecurityException

    Exception Message:     Request for principal permission failed.

    Exception Target Site: ThrowSecurityException

    ---- Stack Trace ----

       System.Security.Permissions.PrincipalPermission.ThrowSecurityException()

           ServiceTest.exe: N 5410579

       System.Security.Permissions.PrincipalPermission.Demand()

           ServiceTest.exe: N 00577

       Service.frmServiceService.btnQueueWork_Click(sender As Object, e As EventArgs)

           ServiceTest.exe: N 05901

    All of the users of this application are members of the same network security group, which gives them administrator rights to all other members of the same group.

    It appears that security policy differs in Windows 8 from Windows 7?  Can someone suggest a solution to try or explain the difference in security policy between Windows 8 and Windows 7?

    Thanks in advance.


    • Moved by Marvin_Guo Tuesday, June 3, 2014 2:38 AM Windows Security Issue
    Monday, June 2, 2014 9:04 PM