to execute PowerShell script (.ps1) w/o initilizing each code signing
step 1) REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
"ExecutionPolicy"="Unrestricted"
By default, the above parameter is not initialised during first time installation. This parameter will remain in the system registry until you remove it manually.
step 2) open powershell object-based function
PS> .\stopit.ps1
Showing posts with label registry. Show all posts
Showing posts with label registry. Show all posts
Monday, January 19, 2009
delete unwanted registry key
to delete both the 'PSHome' and 'PowerShellPath' registry entries
PS> Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PSHome
PS> Remove-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PowerShellPath
PS> Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PSHome
PS> Remove-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PowerShellPath
rename existing registry key
to rename the PowerShellPath entry to "PSHome" and display the renamed value
PS> Rename-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PowerShellPath -NewName PSHome -passthru
PS> Rename-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PowerShellPath -NewName PSHome -passthru
change MaxSize of EventLog via registry
to overwrite a pre-existing registry entry value
PS> New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\Eventlog\Application -Name MaxSize -PropertyType DWord -Value 512 -force
'512' is in decimal format; it means 512KB
PS> New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\Eventlog\Application -Name MaxSize -PropertyType DWord -Value 512 -force
'512' is in decimal format; it means 512KB
change system's prompt
to change to the CurrentVersion registry container
PS> Set-Location -Path hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion
Change from original prompt
`PS C:\Lindows\co\Administrator>`
to
new prompt
`PS HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion>`
PS> Set-Location -Path hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion
Change from original prompt
`PS C:\Lindows\co\Administrator>`
to
new prompt
`PS HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion>`
access CurrentVersion of HKLM
to view the registry entries in a more readable form
PS> Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
DevicePath : C:\LINDOWS\inf
MediaPathUnexpanded : C:\LINDOWS\Media
SM_GamesName : Games
SM_ConfigureProgramsName : Set Program Access and Defaults
ProgramFilesDir : c:\Lindows\cn <--- release Vista's journaling
CommonFilesDir : c:\Lindows\cn <--- release Vista's journaling
ProductId : 55274-642-3428963-23367
WallPaperDir : C:\LINDOWS\Web\Wallpaper
MediaPath : C:\LINDOWS\Media
ProgramFilesPath : C:\LINDOWS\cn <--- release Vista's journaling
SM_AccessoriesName : Accessories
PF_AccessoriesName : Accessories
'C:\LINDOWS' is alternative method of consolidating %ProgramFiles% and %Documents and Settings%, where Vista won't overwrite its system files.
PS> Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
DevicePath : C:\LINDOWS\inf
MediaPathUnexpanded : C:\LINDOWS\Media
SM_GamesName : Games
SM_ConfigureProgramsName : Set Program Access and Defaults
ProgramFilesDir : c:\Lindows\cn <--- release Vista's journaling
CommonFilesDir : c:\Lindows\cn <--- release Vista's journaling
ProductId : 55274-642-3428963-23367
WallPaperDir : C:\LINDOWS\Web\Wallpaper
MediaPath : C:\LINDOWS\Media
ProgramFilesPath : C:\LINDOWS\cn <--- release Vista's journaling
SM_AccessoriesName : Accessories
PF_AccessoriesName : Accessories
'C:\LINDOWS' is alternative method of consolidating %ProgramFiles% and %Documents and Settings%, where Vista won't overwrite its system files.
Sunday, January 18, 2009
create a registry key under HKLM
to create a registry key named '_Test' in the CurrentVersion subkey
PS> New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\_Test
Hive: Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
SKC VC Name Property
--- -- ---- --------
0 0 _Test {}
PS> New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\_Test
Hive: Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
SKC VC Name Property
--- -- ---- --------
0 0 _Test {}
access HKLM registry
to set your location (prompt) to the HKLM\Software key in the registry key
PS> set-location -path HKLM:\software -passthru
Path
----
HKLM:\software
PS HKLM:\software>
PS> set-location -path HKLM:\software -passthru
Path
----
HKLM:\software
PS HKLM:\software>
Subscribe to:
Posts (Atom)