DATA Step, Macro, Functions and more

Launch external process with elevated permissions

Reply
Super Contributor
Posts: 376

Launch external process with elevated permissions

Hi,

Windows Server 2012 R2

SAS 9.4

We've just upgraded from SAS 9.3 to SAS 9.4.  In the process, we also upgraded from Windows Server 2008 to Windows Server 2012 R2.  With that upgrade has been implementation (more like enforcement) of new security policy, namely not disabling User Access Control (UAC).  Finally, "disabling" UAC in Windows Server 2012 is different than Windows Server 2008 - disabling it just turns off prompting, it's not truly disabled as in Windows Server 2008.  Google for more details.

I need to run an external program from SAS (handle.exe from sysinternals) that requires elevated permissions.

Here is some sample code run from SAS 9.4/Windows Server 2012:

1     filename stuff pipe "dir c:\";

2     data _null_;

3     infile stuff;

4     input;

5     putlog _infile_;

6     run;

NOTE: The infile STUFF is:

      Unnamed Pipe Access Device,

      PROCESS=dir c:\,RECFM=V,LRECL=32767

Volume in drive C is Operating System

Volume Serial Number is 6ECF-6DEA

Directory of c:\

23-Aug-13  01:52    <DIR>          PerfLogs

27-Mar-15  14:04    <DIR>          Program Files

30-Apr-15  15:28    <DIR>          Program Files (x86)

06-May-15  17:49    <DIR>          Users

01-May-15  00:15    <DIR>          Windows

               0 File(s)              0 bytes

               5 Dir(s)  29,163,524,096 bytes free

NOTE: 13 records were read from the infile STUFF.

      The minimum record length was 0.

      The maximum record length was 54.

NOTE: DATA statement used (Total process time):

      real time           0.05 seconds

      user cpu time       0.00 seconds

      system cpu time     0.03 seconds

      memory              0.26m

      OS Memory           12.72m

      Timestamp           Wednesday,  6 May 2015 05:59:06 PM

      Step Count                        2  Switch Count  0

7

8     filename stuff pipe "handle";

9     data _null_;

10    infile stuff;

11    input;

12    putlog _infile_;

13    run;

NOTE: The infile STUFF is:

      Unnamed Pipe Access Device,

      PROCESS=handle,RECFM=V,LRECL=32767

Handle v3.5

Copyright (C) 1997-2012 Mark Russinovich

Sysinternals - www.sysinternals.com

Initialization error:

Make sure that you are an administrator.

NOTE: 7 records were read from the infile STUFF.

      The minimum record length was 0.

      The maximum record length was 40.

NOTE: DATA statement used (Total process time):

      real time           0.07 seconds

      user cpu time       0.01 seconds

      system cpu time     0.01 seconds

      memory              0.23m

      OS Memory           12.72m

      Timestamp           Wednesday,  6 May 2015 05:59:07 PM

      Step Count                        3  Switch Count  0

Is there a way I can launch the external process in SAS with elevated permissions, analogous to RMB the Command Prompt icon and choosing "Run as administrator"?

Thanks,

Scott

Ask a Question
Discussion stats
  • 0 replies
  • 185 views
  • 0 likes
  • 1 in conversation