Turn UAC off with python - windows

Does anyone know of a way to turn User Account Control off with python 3.3 for Windows. Possibly editing the registry? I know this is not reccomended, but for my purposes this would be ideal. Please help!

Nevermind. I found the solution! I simply created a function that deletes just in case it already exists (otherwise it won't work) and recreates a registry entry. Here it is:
import win32com.shell.shell as win32shell
def disable_UAC():
command1 = 'reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA'
win32shell.ShellExecuteEx(lpVerb='runas', lpFile='cmd.exe', lpParameters='/c ' + command1)
command2 = 'reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f'
win32shell.ShellExecuteEx(lpVerb='runas', lpFile='cmd.exe', lpParameters='/c ' + command2)

Related

Windows batch script reg add crashing

I am making a batch script and I am having trouble with this line
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 3 /f
When that line runs, the command prompt window closes suddenly. This line is supposed to turn on automatic updates. Thanks for your help.
The command you've shown should work okay, at least in the meaning of any syntas error.
The problem, as per you described in the comments, maybe is that you are not taking into account that when a script has finished, the window has any reason to still open. Or in other words, when all the sentences of you're script are done, the window closes "suddenlly" (the program ends execution).
To pause the batch execution, just use the PAUSE command as follows:
#Echo Off
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 3 /f
PAUSE
Exit /B 0

List Separator script

How can I change the List separator from the command line?
Normally I have to edit a field in: Control Panel → Change keyboards or other input methods → Additional settings
I would love to create a VBScript that I click which automatically changes from , to ;, and another one that goes back.
A single script should suffice. The setting is stored in the registry value HKCU\ControlPanel\International\sList and can be toggled with something like this:
Set sh = CreateObject("WScript.Shell")
path = "HKCU\Control Panel\International\sList"
Set separator = CreateObject("Scripting.Dictionary")
separator.Add True , ";"
separator.Add False, ","
sh.RegWrite path, separator(sh.RegRead(path) = ","), "REG_SZ"
An even easier way to do this is via a .bat file
open notepad, and save the below as semi.bat or whatever you want to call it.
REG ADD "HKEY_CURRENT_USER\Control Panel\International" /f /v "sList" /t "REG_SZ" /d ";"
PAUSE
REG ADD "HKEY_CURRENT_USER\Control Panel\International" /f /v "sList" /t "REG_SZ" /d ","
This will allow you to open the .bat file it will change it to what you need then when you are finished it will change it back.

VS2013RC requires IE10 but i need (not want) IE8

I've been evaluating the VS2013preview since its release and was keen to install the RC. The problem is we need ie8 for legacy testing as many customers out in the field still use it.
As a possible workaround would it be possible to either, skip or fool the install package into thinking its installed? or install ie10 and then drop back to ie8 after installation?
I appreciate there may be some areas of things like browserlink to ie that I cannot use but this is OK as I mostly use chrome for initial dev work prior to testing in the various browsers.
Credit goes to Jimmy here, but here's a hack to make it work:
#ECHO OFF
:IE10HACK
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "9.10.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v svcVersion /t REG_SZ /d "10.0.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "9.10.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v svcVersion /t REG_SZ /d "10.0.9200.16384" /f
GOTO EXIT
:REVERTIE
REG DELETE "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v svcVersion
REG DELETE "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v svcVersion
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "8.0.7601.17514" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "8.0.7601.17514" /f
GOTO EXIT
:EXIT
The problem is you're trying to use the same machine for developing and testing. Don't rely on the local copy of IE on your machine for testing a legacy browser, instead rely on virtual machine copies of Windows and run that specific browser.
If you want a quick & dirty way to test your stuff in specific versions of IE use the IETester as mentioned by others in the comments. http://my-debugbar.com/wiki/IETester/HomePage
You might want to consider simply using a virtual machine to run a copy of Windows with IE8 in it for your testing, since you don't really use it for day to day stuff anyways.
Microsoft announced yesterday that they are removing the requirement.
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/4153040-remove-the-requirment-for-internet-explorer-10-to-

How to set value in registry via batch file in Windows?

I am going to set a value to windows registry.
I want to set variable shit for StupidMS in registry, but the result is wrong. Following is my code.
set stupidMS=shit
echo %stupidMS%
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d ^%stupidMS^%
I think the problem is ^%stupidMS^%, but I quite have no idea how to correct it.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d "%stupidMS%"

Not sure why REG ADD command line does not run in VS setup post build event

In the post-build Event, I have had the following command line,
REG ADD HKLM\SOFTWARE\Microsoft\Office\12.0\Common\General /v EnableLocalMachineVSTO /t REG_DWORD /d 1
, which adds a DWORD type value under the registry key General.
I don't know what else I am missing here - the command line REG ADD just doesn't seem to work for me. After the installation, that key is still missing. If I run it alone using Command Prompt, it's all good though.
There is some issue with visual studio build events.
Even with admin privilege, it cannot register in HKLM.
instead if u try with HKEY_CURRENT_USER, it works great.
REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\12.0\Common\General /v EnableLocalMachineVSTO /t REG_DWORD /d 1

Resources