And not what I tell you to do!
Pop quiz:
What does the following Powershell script do?
$MachineName = '.'
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $MachineName)
$regKey= $reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management",$true)
$regkey.SetValue('PagedPoolSize','FFFFFFFF')
Answer:
Cause pandemonium, as it turns out.
If the registry key already exists, the SetValue method helpfully converts it to the appropriate type (String, Binary Value, Dword, etc). Unfortunately, 'FFFFFFFF' (note the quotes) is a string, not the hex number FFFFFFFF.
Oops.
Windows XP does not like it when that key is not a DWORD. You know all those "don't edit the registry unless you're really sure you know what you're doing or you'll blow up your computer" warnings in Microsoft knowledge base articles? This is a good example of what they mean.
So remember - to err is human, but to really screw things up you need a shell script!
Tags: Oops, Powershell, Registry
Share
Facebook
You need to be a member of The SysAdmin Network to add comments!
Join The SysAdmin Network