Jump to content


Sokoban

SCCM OSD Selcted OU will copy the files​

Recommended Posts

Selcted OU will copy the files

I want my selected OU will copy files to WMS folder in the desktop.

96642-copy-files-1.jpg


And here is the selected OU choose the filepath.

 


How will I do that ?

Copy Files 2.jpg

Edited by Sokoban

Share this post


Link to post
Share on other sites

you could separate individual commands, such as

mkdir %userprofile%\DESKTOP\WMS

and for the Options tab, only run if it that folders exists, therefore that step alone would only run if the folder doesn't exist, and it would create the desired folder...

 

then do something similar for the other bits, that would be how i'd approach it

 

Share this post


Link to post
Share on other sites

Hi Thanks for your answer, I'm not sure you understand my question. Maybe I explain little bit unclear.

I want to make that statement.. 

IF that OU = AAA Copy Files from \\Server\Folder\A

IF That OU = BBB copy files from \\Server\Folder\B

... etc... 

It is possible to do that in Task Sequence ?

Share this post


Link to post
Share on other sites

anything is possible, with powershell you can find out the info as below

 

For user:

Get-ADOrganizationalUnit -Identity $(($adUser = Get-ADUser -Identity $env:USERNAME).DistinguishedName.SubString($adUser.DistinguishedName.IndexOf("OU=")))

For computer:

Get-ADOrganizationalUnit -Identity $(($adComputer = Get-ADComputer -Identity $env:COMPUTERNAME).DistinguishedName.SubString($adComputer.DistinguishedName.IndexOf("OU=")))

once you have that data, you can assign it to a task sequence variable and do whatever you want based on that variable

 

Share this post


Link to post
Share on other sites

15 hours ago, anyweb said:

anything is possible, with powershell you can find out the info as below

 

For user:


Get-ADOrganizationalUnit -Identity $(($adUser = Get-ADUser -Identity $env:USERNAME).DistinguishedName.SubString($adUser.DistinguishedName.IndexOf("OU=")))

For computer:


Get-ADOrganizationalUnit -Identity $(($adComputer = Get-ADComputer -Identity $env:COMPUTERNAME).DistinguishedName.SubString($adComputer.DistinguishedName.IndexOf("OU=")))

once you have that data, you can assign it to a task sequence variable and do whatever you want based on that variable

 

Thanks :-)... but can you show me a example , i'm not sure if understand your solution ... 

// Jonas 

Share this post


Link to post
Share on other sites

here are some pointers,  this should get you started.

to set a task sequence variable called detectedOU in an SCCM task sequence you can create a run command line step like so, it just requires you to set the powershell variable $detectedOU using either of the two detection methods i posted in an earlier post above
 

powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; $tsenv.Value('detectedOU') = $detectedOU}"


once you've set the task sequence variable, you can then create additional run command line steps to take actions based on the %detectedOU% variable value

 

I hope that explains it :)

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

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.