How can i change values in Windows registy without admin permissions - windows

i want to automate something, but it only works if i manually accept the uac window, so i tried to change the registry value with this commads:
c:\Windows\System32\cmd.exe /k c:\Windows\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
But it only works if i run the cmd as administrator. So again i need to accept the uac window to deactivate the uac windows...
Is there a good way to make this with a script ore something like that, or is there a bypass solution? (for automation puroses)

If you want to modify a registry hive without administrative privileges, you have to do it offline1.
To do so, you can boot into WinRE and then use regedit to modify your hives offline. You can also remove your hard disk and put it into another computer where you have administrative privileges and modify it there.
You can find an example here.
1 Offline in this case means, the hives are not mounted. Or in other words, the Windows installation is not running.

Related

How to add program to Windows startup

I want that, when my program runs, it adds itself to Windows startup (if it doesn't exist there).
I tried this:
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v mycompany /d C:\ProgramFiles\mycompany\demo.exe /f
I also tried to copy the shortcut of the program to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
But, I need administrator privileges for both. What should I do?
I need administrator privileges for both. What should I do?
If you want your app to run for all users with a single installation, you need to install it as an admin so you can update the global users profile. So either make a separate installer that runs with admin rights, or make your app run an elevated copy of itself so it can gain temporary admin rights when it needs to access the global profile.
The only way to avoid that is to have each user run the app separately so it can install itself into each individual user's profile. You don't need admin rights for that.
You can change to:
REG ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v mycompany /d C:\ProgramFiles\mycompany\demo.exe /f
Which should be able to write to that part of the registry
The HKLM key has read access for standard users by default. Whereas the HKCU key has write access for the currently logged in user.
If you want the program to run for all users then you could run a setup program with administrator privileges. Usually, you would run installers as administrator or equivalent on Windows.

Script that runs "reg add" as admin

I need help in making a script (bat, vbs, whatever) that runs at startup as a different user (admin) the following command:
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome /f /v RestoreOnStartup /t REG_DWORD /d 1
I've tried combining that with "runas /savecred /user:administrator", without any success..
Background
On my work computer, in Chrome, the Startup Options are disabled. The only way to change them is through the registry, but after every restart, it reverts back to its original form (Continue where left off disabled).
So I would like a script that does enables it every time, so I don't have to do it manually.
If you have default settings use RunAs with the administrator account, except it will be disabled (but if it isn't is will run elevated as if standard settings apply).
This is a security not a programming question.
net user administrator /active:yes
You then have to allow logon with blank password in Local Security Policy.
Then
runas /user server\administrator "notepad.exe \"c:\windows\win.ini\""
The server is YOUR computer name.
I just turn offf UAC.

Changing Windows 7 Wallpaper Remotely

I am trying to remotely change the wallpaper on about 50 computers that are running Win 7 in a WORKGROUP environment.
I have local admin rights to all of them plus they are running an agent (Faronics) that lets me push .bat .exe .msi .vbs and .ps1 to them remotely.
Just wondering if there was any application that lets me do that remotely or if not, what is the easiest way to get my image to these machines and set it as default wallpaper?
The wallpaper that Windows uses is in the registry under the HKCU\Control Panel\Desktop\Wallpaper key
you just can change it with the REG command.
See REG /? and then try...
reg query "HKCU\Control Panel\Desktop" /v Wallpaper
and
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d D:\my.bmp /f
Replacing the file in the following path C:\Users\[user name]\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg is hit or miss depending upon the other desktop background settings shown on the GUI and file type.
I have been able to successfully replace the file with another .jpg file renamed TranscodedWallpaper.jpg and put in its place but the Desktop doesn't just update by itself.
You have to force it with the Rundll32.exe user32.dll,UpdatePerUserSystemParameters command.
This is also hit or miss. I have had it work several times correctly while physically on the computer but cannot get the computer to do the same remotely.
Still working on a 100% working remote solution to fully answer the question.
You can use intelliadmin network administrator to change the desktop pictures remotely on all computers at once

Need help adding registry key via batch file

I am trying to add the following registry key through cmd. I am not able to get other users to be able to add this registry key using regedit.exe /s "Location\Project.reg".
[HKEY_CURRENT_USER\Software\Autodesk\Fabrication 2014\Configuration\1011-Shady-Grove]
"Path"="C:/Autodesk/Profiles/05MA/1011-Shady-Grove"
You are using the wrong tool. Regedit is a GUI tool. Yes you can use the /s switch, but fundamentally this is the wrong tool. Plus it is built with the highestAvailable option in the UAC manifest.
What you need is reg. Use it like this:
reg add "HKCU\Software\Autodesk\Fabrication 2014\Configuration\1011-Shady-Grove" /v Path /d C:/Autodesk/Profiles/05MA/1011-Shady-Grove
AFAIK, regedit will refuse to do anything if the user doesn't have administrative access, even if he has access to the registry keys.
Try the reg add command.

How do I automatically launch a non-Surface application in Windows Embedded 8?

How do I automatically launch a non-Surface application in Windows Embedded 8?
I want to automatically launch a GUI application on startup in Windows Embedded 8, but I can't figure out how to do it. I've been reading Sean Liming's Professional's Guide to Windows Embedded 8 Standard, and in chapter 8 he describes how to modify the device experience. He names how there is a Windows 8 Application launcher, but for Surface apps only. He also describes a Shell Launcher module, but my app is not a shell. He also mentions a shell he wrote here, but reading through its documentation, it doesn't describe how to automatically launch a program within that shell.
As far as I can tell, he doesn't describe how to automatically launch a non-Surface application anywhere, and Google and Stack Exchange get me no results (it doesn't help that most results come back as merely Windows 8, and not Windows Embedded 8). Or am I mistaken? Is Shell Launcher sufficient to launch a non-shell app? Does the app launched become the "shell", in effect?
Side note: It's probably worth mentioning that the app I want to launch is a Java app. I will be including the module-based Java JRE installer as mentioned in the book, but if there are any other provisos to launching a Java app in WE8S, please comment.
Thanks for your time and feedback!
This works for both Windows Embedded Standard 7 and Windows Embedded 8 Standard:
I normally install Windows Embedded Standard with the standard shell. In WE8S this would be the Metro UI. Once installation and configuration is complete, and your application runs successfully, I use registry entries to modify the application launched on startup.
Custom user-specific shell
As an example, to launch VLC media player as the shell, and play media files in a folder on the d:\ e.g d:\media in a continuous loop, I use the below in a .bat file, running as administrator.
This must be run while logged into the user that will launch the custom shell
Create a new .bat file:
in Windows Explorer, Select "File" -> "New" -> "Text Document"
Rename "New Text Document.txt" to custom_shell.bat
Paste the below into the file
Save the file
Right click the file -> "Run as Administrator"
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d explorer.exe
c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "c:\program files\vlc\vlc.exe -f --loop ""d:\media"""
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
pause
This modifies the shell for the !Current User! (i.e. the logged on user) to launch VLC.exe on logon. (I use reg.exe because some slimmed down installations might not have regedit.exe included)
This means that you can still access the full user interface when logging on as the administrator user (via safe mode if Administrator profile is normally disabled), since the shell for all other users is still the explorer shell.
Launching the explorer shell from within the custom shell
You can still launch the explorer shell with the metro UI when the user with the custom shell is logged on. To launch the explorer shell from the user running the VLC (custom) shell:
Start the task manager (CTRL+SHIFT+ESC)
Click on the "Advanced" button at the bottom of the task manager
Select "File" -> "New Task (Run...)" from the menu bar
Enter "Explorer.exe" (This start the explorer service)
Repeat the above steps again (This will lauch an instance of Windows Explorer)
The Metro UI should be usable then
Java application as a shell
More to the point, in order to run your java app, change the below entry in the above .bat
from:
c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "c:\program files\vlc\vlc.exe -f --loop ""d:\media"""
to
c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "java [any other JVM options you need to give it] -jar "path\jar-file-name.jar""
If your java app does not include a manifest the above will not work!
Try this (I have not tested this):
java -cp jar-file-name.jar full.package.name.ClassName
Revert to the Explorer (default shell) i.e. Undo user-specific shell
To undo the shell changes for the user i.e. revert back to original settings:
!This must be run while logged into the user with the custom shell!
Create a new .bat file:
in Windows Explorer, Select "File" -> "New" -> "Text Document"
Rename "New Text Document.txt" to default_shell.bat
Paste the below into the file
Save the file
Right click the file -> "Run as Administrator"
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d explorer.exe
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "SYS:Microsoft\Windows NT\CurrentVersion\Winlogon"
c:\Windows\system32\reg.exe DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
pause
User Auto Logon:
You can configure Windows to automatically log onto a specific user profile.
Start > Search > netplwiz
OR [Windows Key + R] > netplwiz
A ‘User Account’ window will open. Highlight the account you want to automatically load when Windows starts.
Uncheck the box above it titled “Users must enter a user name and password to use this computer.”
Click OK.
You will be prompted to confirm the operation by entering your password.
Enter your password to complete the change.
The next time you start up Windows, the user account you selected will automatically be loaded
Things to consider
Play around, but use a test environment if possible
If you can launch the shell, so can someone else. Use the keyboard filter to filter out known key combinations, and create one only you, and perhaps the service technicians will know.
Remove admin rights for the user with the custom shell
Use the Unified Write Filter (or Enhanced Wright Filter/File Based Write Filter). Un-protect only when making changes.
A big THANK YOU to Sean Liming and the work that does - he inspired this.
Mark Böhmer
Windows Embedded Specialist
South Africa

Resources