You are here: PSPad forum > English discussion forum > Re: UAC-elevating PsPad.exe - Not able to rightclick *.vbs file

Re: UAC-elevating PsPad.exe - Not able to rightclick *.vbs file

#1 UAC-elevating PsPad.exe - Not able to rightclick *.vbs file

Posted by: nergmlam | Date: 04/18/2012 09:37 | IP: IP Logged

Hi

I work in the IT-Department, but have a scenario where my company's security rules forces me ALWAYS to logon as USER1 NOT being local administrator, and when needed (UAC elevation or remote access to our company's 3.500 computers) I can logon as USER2 BEING local administrator on my own computer, and on ALL our computers.

So, as USER2 I can gain access to e.g. \\Computer2845\C$ using explorer.exe

BUT when running PsPad.exe as USER1 I can't (of course not) open a file on \\Computer2845\C$

So I need to rightclick PsPad.exe and select to "Run as another user", and logon as USER2.

Then everything works perfect in PsPad, and I can open a file on \\Computer2845\C$, BUT BUT BUT

Quote:
BUT when I rightclick a *.vbs file on my computer or my fileserver, nothing happens except the hourglass for 5 seconds, and that's no matter if PsPad.exe is closed or running in systray or open.

My settings is:

C:\Program Files\PsPad editor\PSPad_MU.ini
[Config]
MultiUser=1

C:\Users\USER2\AppData\Roaming\PsPad\PsPad.ini
[Config]
TrayEnabled=1
CloseMinimize=0

[Multi]
VBScript=1

[Highlighters]
VBScript=1

[MS VBScript]
Filter=VBScript files (*.vbs;*.asa)|*.vbs;*.asa

[Registered FileTypes]
0=.vbs

[HKEY_CURRENT_USER\Software\Classes\vbsfile\Shell\Edit\Command]
@="C:\\Program Files\\PSPad editor\\PSPad.exe \"%1\""
" "="\"C:\\Program Files\\PSPad editor\\PSPad.exe\" \"%1\""

[HKEY_CLASSES_ROOT\*\shell\PSPad\Command]
@="\"C:\\Program Files\\PSPad editor\\PSPad.exe\" \"%1\""

[HKEY_CLASSES_ROOT\VBSFile\Shell\Edit\Command]
" "="\"C:\\Program Files\\PSPad editor\\PSPad.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\PSPad\Command]
@="\"C:\\Program Files\\PSPad editor\\PSPad.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\VBSFile\Shell\Edit\Command]
" "="\"C:\\Program Files\\PSPad editor\\PSPad.exe\" \"%1\""

--
Sincerely

J. Malmgren
IT-Programmer
Denmark
Version 4.5.7(2441)

Options: Reply | Quote | Up ^


#2 Re: UAC-elevating PsPad.exe - Not able to rightclick *.vbs file

Posted by: nergmlam | Date: 04/23/2012 09:44 | IP: IP Logged

Hi Jan

I didn't find a solution, but I found a "workaround", that works:

1. I renamed your PsPad.exe to e.g. PsPad-uac.exe

2. I change PsPad.exe to PsPad.cmd in this regkey:

Quote:
[HKEY_CLASSES_ROOT\*\shell\PSPad\Command]
@="\"C:\\Program Files\\PSPad editor\\PsPad.cmd\" \"%1\""

3. I made a PsPad.cmd file in same folder as "your" PsPad-uac.exe

Quote:
@ECHO OFF
CLS

SET PsPadExe=C:\Program Files\PsPad Editor\PSPad-uac.exe
SET Domain=YourDomainName
SET UserName=USER2

ECHO.
ECHO Starting the PsPad Editor as %Domain%\%UserName%
ECHO.

%WINDIR%\System32\Runas.exe /noprofile /user:%Domain%\%UserName% "%PsPadExe%"

EXIT

Now it doesn't matter if PsPad-uac.exe is running or not.

When I rightclick a .vbs file, and select PsPad in context menu, a command prompt is asking me to enter my password to YourDomainName\USER2, and then PsPad-uac.exe is loaded, and works with my settings in:

C:\Users\USER2\AppData\Roaming\PsPad

And I can connect to \\ComputerName\C$

smiling smileysmiling smileysmiling smiley

--
Sincerely

J. Malmgren
IT-Programmer
Denmark
Version 4.5.7(2441)

Options: Reply | Quote | Up ^


#3 Re: UAC-elevating PsPad.exe - Not able to rightclick *.vbs file

Posted by: nergmlam | Date: 04/23/2012 09:52 | IP: IP Logged

Warning!!!

If anybody else is using this "workaround", then please note, that the Runas.exe command in older OS-versions could make it possible to save credentials (password) in such a cmd-file.

BUT DON'T EVER DO THAT !!!!

--
Sincerely

J. Malmgren
IT-Programmer
Denmark
Version 4.5.7(2441)

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2014 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák