maxXPsoft Posted November 21, 2013 Author Share Posted November 21, 2013 (edited) $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. exampleC:\Program FilesC:\Program Files (x86)I can get the processor but not this Edited November 21, 2013 by maxXPsoft Link to comment Share on other sites More sharing options...
MrJinje Posted November 22, 2013 Share Posted November 22, 2013 (edited) 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. exampleC:\Program FilesC:\Program Files (x86)I can get the processor but not thisTry 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#post837143If ($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 November 22, 2013 by MrJinje Link to comment Share on other sites More sharing options...
bphlpt Posted November 22, 2013 Share Posted November 22, 2013 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 More sharing options...
MrJinje Posted November 22, 2013 Share Posted November 22, 2013 (edited) 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 RegardsGood 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=7010269Configuring 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 November 23, 2013 by MrJinje Link to comment Share on other sites More sharing options...
Octopuss Posted January 11, 2015 Share Posted January 11, 2015 I started using this again, and was curious whether there was any other way to make wiminfo pause other than doing it with powershell. The window just flashes and disappears Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now