Jump to content


CoNtAcT2000

cmd script to set some registry settings

Recommended Posts

Hi,

 

i build a package to deploy 7-zip. That works fine.

Now i want to define the file extensions that opens with 7-zip (they are not set by default und i didnt find any switch) with the following cmd script:

 

SET SC=HKLM\SOFTWARE\Classes

SET Extn=7z-0 arj-4 bz2-2 bzip2-2 cab-7 cpio-7 deb-11 gz-14 gzip-14 iso-8 lha-6 lzh-6 rar-3 rpm-10 split-9 swm-15 tar-13 taz-5 tbz-2 tbz2-2 tgz-14 tpz-14 wim-15 z-5 zip-1

FOR %%j IN (%Extn%) DO (

FOR /F "tokens=1,2 delims=-" %%A IN ("%%j") DO (

REG ADD %SC%\.%%A /VE /D "7-Zip.%%A" /F

REG ADD %SC%\7-Zip.%%A /VE /D "%%A Archive" /F

REG ADD %SC%\7-Zip.%%A\DefaultIcon /VE /D "%PROGRAMFILES%\7-Zip\7z.dll,%%B" /F

REG ADD %SC%\7-Zip.%%A\shell\open\command /VE /D "\"%PROGRAMFILES%\7-Zip\7zFM.exe\" \"%%1\"" /F

)

)

 

The Script works in a normal cmd.

 

So ive created a new Programm in the 7-Zip package (commandline: config.cmd. After that, i added the new Programm to my TS.

But it always fails with the Error Code 0x800700FF

 

Whats wrong?

Share this post


Link to post
Share on other sites

We can use PowerShell to translate the Win32 error code into a [more] useful description:

 

PS C:\Users\trevor.sullivan> [componentmodel.win32exception]0x800700FF

The extended attributes are inconsistent

 

http://learn-powershell.net/2011/06/28/quick-hits-translate-windows-error-codes/

 

Hmmmm, in this case, it's still a bit of a confusing error message. What extended attributes -- is it talking about file attributes? Probably not, since I'm not aware of any attribute "extensions" for the NTFS filesystem.

 

Here's one thing ... as a best practice, I always recommend that when building and testing packages or scripts in SCCM, before deploying it through SCCM, simply try running the command line as the Local System account. How do you do this? Download Sysinternals psexec, and use the -s parameter to invoke a command as Local System. This will help to ensure that your command still works even when SCCM executes it as Local System, rather than your user credentials.

 

Hope this helps.

 

Cheers,

Trevor Sullivan

http://trevorsullivan.net

http://twitter.com/pcgeek86

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...