Skip to content

SiteServer and/or DP Hostname in a Task Sequence

Featured Replies

Hello Guys!

 

I've got a question for you: How can I use the hostname of the SiteServer as a variable in a TaskSequence?

 

Background: I want to build tasksequences, that copy a specific file from a server via UNC on the SiteServer and I want to have this TaskSequence independent from the specific installation (i.e. export and import it on a different server)

 

Thanks!

 

BR,

Haiko

Might be a stupid question, but why do you want to use a UNC path for this? The file is located on the DP, correct? So why not just place the file in a folder, referance that folder when you create a package and use %~dp0 when you are going to copy the file?

 

Example:

  • Make a folder on your main sccm-server (i.e: E:\Sources\Applications\MyApp\<Version>)
  • Inside of that folder you you create a new folder contaning the files you want copied
  • make a bat-file in the root-folder that says something like:

xcopy "%~dp0FolderWithFilesIwantToCopy" "C:\Temp\Example\MyDestination" /C /R /H /K /Y /I /S
:: %~dp0 contains the running dir path, so you can use it no matter what distribution point the client got the package from
:: Other stuff you might want to do...

  • Make a new package in SCCM, and referance the above folder in "this pacakge contains sources files" in the first window of the wizard. But use UNC (\\myserver\Sources\Applications\MyApp\<Version>), remember to share your "sources" folder first
  • In the program window choose the bat file

 

Basic example if incase you are new, otherwise pardon me for boring you :)

  • Author

Still, this needs the Server's name... Isn't there a way to use the hostname as a variable?

I don't understand why you would need the severname, care to explain?

 

To be clear: the UNC path (with servername) that you define when you make a package is only the source location. SCCM wil make a package out of the files in the folder and distribute that package to other DPs, so the source location won't really be used in deployments.

  • 2 weeks later...
  • Author

I know, but inside my Task Sequence I'm calling for several scripts and copy files that are on UNC (i.e. a share on the SCCM-Server)....

But why not just place those files inside of the package-folder and use %~dp0?

  • 2 weeks later...
  • Author

What is "%~dp0" and how does it work?

  • Author

Could you pls explain that a little more in detail?? Thank you!!

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.