64bit - Powershell scripts not running as expected (when called from elevated user) following move to Windows 7 64 bit -


i have weird problem. have scripts (login scripts , such) require elements run elevated user.

(to give background, use uac prevent running without user putting in password. routine, elevated, tasks want run without user intervention wrote small .net app runs command line input elevated user.)

this has been working number of years. testing windows 7 64 bit , process no longer works. test process have written following small script:

if ( $args[0].length -eq 0) {      $message = "no input passed"  } else {     $message = $args[0] }   $a = new-object -comobject wscript.shell  $b = $a.popup($message) 

all pop message box whatever user input passed it.

test results:

1) invoking creating new process

([wmiclass]"win32_process").create('powershell c:\users\me\desktop\testargs.ps1 "hello"') 

result: works expected - box pops saying "hello"

2) invoking (with arguments) using .net elevation utility

([wmiclass]"win32_process").create('c:\swtools\elevator.exe powershell c:\users\me\desktop\testargs.ps1') 

result: powershell window opened administrator (as shown on title bar) hangs flashing cursor when window opens - no pop shown. (on win7 32 bit machine works expected - "hello" popup displayed)

3) calling powershell (with no arguments) elevation utility

([wmiclass]"win32_process").create('c:\swtools\elevator.exe powershell') 

this works expected - elevated powershell window opened.

initially made me think elevator utility , way passing arguments. however, can call app fine, in:

4) calling notepad (with arguments) elevation utility

([wmiclass]"win32_process").create('c:\swtools\elevator.exe powershell notepad.exe "c:\users\me\desktop\testargs.ps1"') 

this opens instance of notepad (process owned administrator) showing contents of script.

basically each individual part seems working expected, 3 not work. (as say, works on win7 32 bit.)


Comments