Jump to content


  • 0
Gorilla

Task Sequences

Question

I'm using a task sequence to only run a command. For example: regedit /s <file>.reg

 

I'm setting one up for the first time and I created the task, edited it, added the Run Command Line task, and then placed the above in the command line field.

 

Then I placed the .reg file on a network share and placed that path in the Start In: field.

 

Finally I advertised it to a collection with one workstation for as soon as possible and made it mandatory with WoL.

 

It didn't work until I abandoned the "Start In" field and created a package out of the reg file. So what is the purpose of the 'Start In' field if it isn't the working directory? I didn't change the location of the file, only made a package out of it and cleared the 'Start In' field.

 

So while I've figured out a way to do it, every reference I've found to the 'Start In' field in task sequences touts it as the working directory. Looking for any clarity in how Task Sequences used for Command Line tasks should be leveraged, especially if there's a file involved.

 

Thanks a ton!

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

i think the built in help explains it quite well:

 

Start in

 

Specifies the executable folder for the program, up to 127 characters. This folder can be an absolute path on the target computer or a path relative to the distribution point folder that contains the package. This field is optional.

 

Examples:

 

c:\officexp

 

i386

Note

The Browse button browses the local computer for files and folders, so anything you select this way must also exist on the target computer in the same location and with the same file and folder names.

 

so based on the above, did you browse for any folder on the dp package or locally ? and if local, did it exist on the target computer ?

Share this post


Link to post
Share on other sites

  • 0

i think the built in help explains it quite well:

 

 

 

so based on the above, did you browse for any folder on the dp package or locally ? and if local, did it exist on the target computer ?

 

Thanks for the response. You are absolutely right that I both forget how good the help is in SCCM (not used to that!) and that I didn't use it. I needed an excuse to visit your site again anwyay. :>) If it's any consolation, the help didn't help me in this case though.

 

Just got back to checking the status of my task. It reported as succeeded but then when I checked, the registry value was not updated. Which is strange because it did work in my test with one machine. All I changed was the collection.

 

No I do not have the file locally and I hope that I won't have to as that would be hard to do on all clients for advertised tasks. Instead I created a package on a network share that is accessible by the install base. And it did work when I tested it, so now I'm thinking maybe they are one hit wonders and I needed to re-advertise it when I changed the collection and schedule.

 

I'll need to mull this over tomorrow so if you see any obvious misconceptions on my part, I'll appreciate having them pointed out.

 

Cheers!

 

-Kelly

Share this post


Link to post
Share on other sites

  • 0

what reg key are you trying to add/edit ? and how ? are the systems 64 bit ?

 

I have an application that points at a license server. The server name is in a HKLM/Software/<name>\License\<dword value> registry key. I need to update the value. I've done lot's of login scripts that import registry settings and wanted to use SCCM to hopefully have a tested way I can execute a Reg command on clients to get away from the login script model. These are all 32-bit XP clients.

 

So basically I have a DWORD value of <servername> in a .reg file with the command regedit /s <file>.reg (and I've tried Reg /import as suggested)

 

My problem it turns out is executing the command while having having the reg file on a network share. I have both tried using a UNC and a mapped drive letter and it fails. If I place the file on a local drive, it works. I had hoped that SCCM abstracted that when I built a package but I'm guessing that's my problem. So unless I learn otherwise, I'll just put the logic in a script (copy file locally > execute file > check value > delete file) and at that point, I don't even need SCCM. Though if it's possible, I'd like to understand the best practice methodology. I've never run out of situations where a registry value needs to be added, deleted, or modified on a host of clients.

Share this post


Link to post
Share on other sites

  • 0

i think the built in help explains it quite well:

 

 

 

so based on the above, did you browse for any folder on the dp package or locally ? and if local, did it exist on the target computer ?

 

Note that the help file for the OSD task sequence is inaccurate for running command lines from within a package. It states that you can put in a path relative to the package source. However the interface doesn't allow you to enter anything that does not begin with "\\" without seeing the red (!) to the right. And in true Microsoft fashion they don't show any examples either!

Share this post


Link to post
Share on other sites

  • 0

Note that the help file for the OSD task sequence is inaccurate for running command lines from within a package. It states that you can put in a path relative to the package source. However the interface doesn't allow you to enter anything that does not begin with "\\" without seeing the red (!) to the right. And in true Microsoft fashion they don't show any examples either!

 

Here are a couple of examples of registry hacks I've added during OSD Deploy task Sequences on a 64-bit Windows 7 systems:

 

 

cmd /c "reg add HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon /v DefaultDomainName /t REG_SZ /d MyDomain /f"

 

The below requires the Disable 64-bit file redirection option select as the commands execute in 32-bit mode by default.

 

cmd /c "reg add HKCR\CLSID\{<some GUID>}\Instance\InitPropertyBag /v Param1 /t REG_SZ /d http://intranet /f"

Share this post


Link to post
Share on other sites

  • 0

Note that the help file for the OSD task sequence is inaccurate for running command lines from within a package. It states that you can put in a path relative to the package source. However the interface doesn't allow you to enter anything that does not begin with "\\" without seeing the red (!) to the right. And in true Microsoft fashion they don't show any examples either!

 

yes the documentation could improve here, and here's a few examples of how to do it:-

 

 

Copy all files from a package to a directory on the target

 

let's say that I want to copy some files from a package to a folder locally on my target, to do so you need to try something like this

 

create a new Run Command Line step in your task sequence:

 

in the command line field paste the following

 

xcopy.exe ".\*.*" "c:\somedir" /D /E /C /I /Q /H /R /Y /S

 

in the Package field, browse to your chosen package on your sccm server.

 

and that's it you are done !

 

 

Run a script from a package

 

if you want to run a VBS or similar script from a package, here's one way of doing it

 

create a new Run Command Line step in your task sequence:

 

in the command line field paste the following

 

cscript.exe ".\myscript.vbs"

 

in the Package field, browse to your chosen package on your sccm server.

 

 

 

the important bit above (which is missing from the documentation) is the ".\" this instructs the task to start whatever it's doing at the root of the package, if you omit this you'll end up at the root of ALL PACKAGES with very strange results indeed (especially if you are trying to copy stuff)

 

does this help ?

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
Answer this question...

×   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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.