Jump to content

Add Right click .wim Windows 7 or Windows 8/8.1


Recommended Posts

$KILLPROCESS = (Get-Process | Select-Object -Property Id,ProcessName | Out-GridView -passthru -Title "Wise Guy Process Killer").ProcessName;Get-Process $KILLPROCESS | ForEach-Object -Process {Stop-Process -Id $_.ID}#

I've been trying to figure out how to add certain things to the registry with a reg script and change them if they 32 or 64 bit. example

C:\Program Files

C:\Program Files (x86)

I can get the processor but not this

Edited by maxXPsoft
Link to comment
Share on other sites


I've been trying to figure out how to add certain things to the registry with a reg script and change them if they 32 or 64 bit. example

C:\Program Files

C:\Program Files (x86)

I can get the processor but not this

Try this, it should pipe the (x86) path on x64 builds. Note: From powershell if the registry key does not exist it'll error on set-itemproperty, so we test-path beforehand to be safe.

If ((Get-WmiObject -class Win32_OperatingSystem | Select-Object OSArchitecture).OSArchitecture -eq "64-bit") {$PROGS = "C:\Program Files (x86)"}else{$PROGS = "C:\Program Files"}$PROGSIf ( -Not (Test-Path 'registry::HKEY_CURRENT_USER\Software\Jinje')) {New-Item -Path 'registry::HKEY_CURRENT_USER\Software\' -Name Jinje -Force;}Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Jinje' -Name $PROGS -Value 1;#
Unless I am mistaken and could have just used the new-itemproperty the whole time. Oh well getting late.

Here I am using null "" variables to toggle ($OFF / $ON) for something, in case you ever wanted to switch from a mounted image to an online image.

http://forums.mydigitallife.info/threads/48613-Aunty-Mel-s-Cheap-And-Nasty-SxS-File-Expander-(Updated-2013-09-29)?p=837143&viewfull=1#post837143

If ($radiobuttonOnline.Checked -eq $true){$On = " /online "}else{$On = ""}

If ($radiobuttonOffline.Checked -eq $true){$Off = " /Image:" + $MountPath + "\Windows "}else{$Off = ""}

and because they are toggled null, we can be lazy and send both variables into the command, knowing one of them would be blank.

$labelParse.text = "cscript.exe " + $MOVE + "\sxsextract.vbs" + $DEB + $VIC + $RES + $On + $Off + $textbox1.text + " " + $textbox2.text

Edited by MrJinje
Link to comment
Share on other sites

I could be wrong, but I think you can replace this:

If ( -Not (Test-Path 'registry::HKEY_CURRENT_USER\Software\Jinje')){New-Item -Path 'registry::HKEY_CURRENT_USER\Software\' -Name Jinje -Force;Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Jinje' -Name $PROGS -Value 1;}else{Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Jinje' -Name $PROGS -Value 1;}
with this:

If ( -Not (Test-Path 'registry::HKEY_CURRENT_USER\Software\Jinje')) {New-Item -Path 'registry::HKEY_CURRENT_USER\Software\' -Name Jinje -Force;}Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Jinje' -Name $PROGS -Value 1;
Correct?

Cheers and Regards

Link to comment
Share on other sites

with this:

If ( -Not (Test-Path 'registry::HKEY_CURRENT_USER\Software\Jinje')) {New-Item -Path 'registry::HKEY_CURRENT_USER\Software\' -Name Jinje -Force;}Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Jinje' -Name $PROGS -Value 1;
Correct?

Cheers and Regards

Good eye. I slapped that together pretty haphazardly. But then again, Max is entering them via a .reg file, so they will pre-exist, moot point.

Was reading here, just some info for me on the appcompatflags you've been using.

http://www.novell.com/support/kb/doc.php?id=7010269

Configuring Applications to Always Request Elevated Rights:
Programs can be configured to always request elevation on the user level via registry settings under HKCU. These registry settings are effective on the fly, so they can be set immediately prior to launching a particular application and even removed as soon as the application is launched, if so desired. Simply create a “String Value” under“HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers” for the full path to an executable with a value of “RUNASADMIN”. Below is an example for CMD.
Windows Registry Editor Version 5.00[HKEY_Current_User\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]"c:\\windows\\system32\\cmd.exe"="RUNASADMIN" 
Edited by MrJinje
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...