Editing registry on x64 server
Setting the scene. We have Windows 2003 SP2 R2 x64 server's. I am trying to remove a reg key under UserData (SID) e.g. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-21- 3590526872-3481884770-766563637-500\Products\86C75AD641D7E7E4E8119DAD64806AD4] Because the sid changes per machine i cant just use a reg delete, so i wrote a powershell script.. Command to run… remove-item hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\*\Products\86C75AD641D7E7E4E8119DAD64806AD4 –recurse This works just fine when run from powershell on the machine. When trying to run this command from a Task Seq command line step... C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{remove-item hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\*\Products\86C75AD641D7E7E4E8119DAD64806AD4 –recurse}" It doesn't work, checking the smsts.log on the server it shows... Remove-Item : Cannot find path 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\C InstallSoftware 29/06/2010 1:25:18 PM 2184 (0x0888) urrentVersion\Installer\UserData' because it does not exist. InstallSoftware 29/06/2010 1:25:18 PM 2184 (0x0888) At line:1 char:14 InstallSoftware 29/06/2010 1:25:18 PM 2184 (0x0888) + &{remove-item <<<< hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer InstallSoftware 29/06/2010 1:25:18 PM 2184 (0x0888) which makes me think that the asterisk(*) in the command line step is causing issues. Unable to find a way to make the task sequence step run successfully(how can i make the TS not treat the * as a special char), i decided to put the commands i want to run in a powershell script and create a package and call the package from my task sequence instead. No i have another issue, again the script runs fine when run normall from the RUN box, or command prompt from server, however when executed from sccm it still does not work. Now the issue i believe is due to 64bit redirection, i think because sccm is running as a x86 process it is spawning my powerhshell as a x86 process and hence can not access x64 bit part of the registry. For task sequence command line steps you can tick the option to disable x64 file system redirection, but i cant see how to enable this if running a package from a TS. Any one have any suggestions on how to resolve my two issues. Thanks in advance.
June 30th, 2010 4:14am

Why not use the command-line task then? Just specify your package and instead of using a program put the command-line from the program in the command-line task.Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
Free Windows Admin Tool Kit Click here and download it now
June 30th, 2010 5:21am

Thanks Jason, have you actually tried what you are suggesting? I have tested specifying the package under the command line task. Then calling the script which is contained within the package. If i untick 64bit redirection, it runs successfully however writes to the wow6432node despite showing that it is written to the 64 bit part of the reg in the smsts.log (Note: i have changed package to do a New-Item instead of a remove-item for while testing ). Executing command line: Run command line InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer InstallSoftware 30/06/2010 11:37:24 AM 780 InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) SKC VC Name Property InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) --- -- ---- -------- InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) 0 0 TEST {} InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) Process completed with exit code 0 InstallSoftware 30/06/2010 11:37:24 AM 780 (0x030C) Now if i tick 64bit redirection it fails with the following error Failed to run the last action: Run cleanup script(disable x64 redirection). Execution of task sequence failed. Incorrect function. (Error: 00000001; Source: Windows)
June 30th, 2010 6:56am

Any answers to this? I'm having the same trouble with a Windows 2008 R2 deployment.
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 10:24am

Any answers to this? I'm having the same trouble with a Windows 2008 R2 deployment. It's the second posting where you're asking the same. Please avoid double postings in the future. Thanks. See http://social.technet.microsoft.com/Forums/en-US/configmgrswdist/thread/33ca35b8-bb39-4144-a049-7ea0e1b252c9/#0ecffaf9-96be-4467-b642-bab3ee761e47 Torsten Meringer | http://www.mssccmfaq.de
July 5th, 2011 11:05am

Could it be that the command is running during the PE step? If that is the case, HKLM points to the largely useless PE registry hive and you cannot access the real Windows registry. You would have to first do a "Reboot Computer - Installed OS" step to make sure the correct boot device is used.
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2011 4:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics