HaikoH Posted August 30, 2012 Report post Posted August 30, 2012 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 Quote Share this post Link to post Share on other sites More sharing options...
wdge Posted August 30, 2012 Report post Posted August 30, 2012 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 Quote Share this post Link to post Share on other sites More sharing options...
HaikoH Posted September 5, 2012 Report post Posted September 5, 2012 Still, this needs the Server's name... Isn't there a way to use the hostname as a variable? Quote Share this post Link to post Share on other sites More sharing options...
wdge Posted September 5, 2012 Report post Posted September 5, 2012 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. Quote Share this post Link to post Share on other sites More sharing options...
HaikoH Posted September 19, 2012 Report post Posted September 19, 2012 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).... Quote Share this post Link to post Share on other sites More sharing options...
wdge Posted September 20, 2012 Report post Posted September 20, 2012 But why not just place those files inside of the package-folder and use %~dp0? Quote Share this post Link to post Share on other sites More sharing options...
HaikoH Posted October 4, 2012 Report post Posted October 4, 2012 What is "%~dp0" and how does it work? Quote Share this post Link to post Share on other sites More sharing options...
Peter van der Woude Posted October 4, 2012 Report post Posted October 4, 2012 It's a batch variable that resolve to the directory of the batchfile. Quote Share this post Link to post Share on other sites More sharing options...
HaikoH Posted October 11, 2012 Report post Posted October 11, 2012 Could you pls explain that a little more in detail?? Thank you!! Quote Share this post Link to post Share on other sites More sharing options...
Peter van der Woude Posted October 11, 2012 Report post Posted October 11, 2012 Take a look here for a similar thread and lots of informational links: http://stackoverflow.com/questions/5034076/what-does-dp0-mean-and-how-does-it-work Quote Share this post Link to post Share on other sites More sharing options...