question

Jonashrvall-2889 avatar image
0 Votes"
Jonashrvall-2889 asked SimonRenMSFT-3639 edited

SCCM OSD Selcted OU will copy the files

Hi I want my selected OU will copy files to WMS folder in the desktop. ![96642-copy-files-1.jpg][1] And here is the selected OU choose the filepath. How will I do that ? Please help me Sokoban ![97162-copy-files-2.jpg][2] [1]: /answers/storage/attachments/96642-copy-files-1.jpg [2]: /answers/storage/attachments/97162-copy-files-2.jpg

mem-cm-osd
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimonRenMSFT-3639 avatar image
0 Votes"
SimonRenMSFT-3639 answered SimonRenMSFT-3639 edited

Hi,

Thanks for posting in Microsoft MECM Q&A forum.

Thanks for your reply.

As I understand it, we could try to use multiple Copy Files to WMS task sequence steps to achieve your goal.
In Copy Files to WMS A task sequence step, if the condition OU=AAA is true, copy Files from \\Server\Folder\A; if the condition OU=AAA is false, do nothing.
In Copy Files to WMS B task sequence step, if the condition OU=BBB is true, copy Files from \\Server\Folder\B; if the condition OU=BBB is false, do nothing.
...etc...

Thanks for your time.

Best regards,
Simon


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
https://docs.microsoft.com/en-us/answers/articles/67444/email-notifications.html

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes its right,

Do you have any solution ?

0 Votes 0 ·

Hi,

Thanks for your time. Please try below workaround:

1.Afer OSD, we can create the collection AAA based on the OU AAA.
2.And then deploy the package with below copying files script to the OU based collection AAA.
**if not exist "%~1" md "%~1"
copy /y "%~dp0Files2Copy*." "%~1"*

For more information, please refer to: Copying Files to Clients Using ConfigMgr

Best regards,
Simon



0 Votes 0 ·
Jonashrvall-2889 avatar image
0 Votes"
Jonashrvall-2889 answered Jonashrvall-2889 edited

Hi Thanks for your answer, 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... I have done following solution. ![97254-skarmbild-2021-05-17-201414.jpg][1] ![97218-skarmbild-2021-05-17-201449.jpg][2] [1]: /answers/storage/attachments/97254-skarmbild-2021-05-17-201414.jpg [2]: /answers/storage/attachments/97218-skarmbild-2021-05-17-201449.jpg Something I missing ?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimonRenMSFT-3639 avatar image
0 Votes"
SimonRenMSFT-3639 answered SimonRenMSFT-3639 edited

Hi,

Thanks for posting in Microsoft MECM Q&A forum.

Based on my understanding, you would like to copy files to WMS folder in the desktop if the computer is in an Active Directory Organization Unit. If I have misunderstood anything, please feel free to let me know.

1.Per my experience, the simpiest way: you can create a OU based collection after OSD and then deploy the copying files script as a package/task sequence to the OU based collection.
Create SCCM Collections based on Active Directory OU

2.You could try using a PowerShell script like below to check that the named computer is in the OU or not and set a task sequence variable that can be used as a condition in the Copy WMS Files task sequence step then.

import-module activedirectory

$OU = @()
$CheckOU = "LaptopOU"
$computerName = "Laptop12345"

$user = get-adcomputer $computerName -Properties *
$user.DistinguishedName -split "," | %{If($ -match "OU="){$OU += $ -replace "OU=",""}}

If($OU -match $CheckOU){
"Computer:$computerName is in the OU:$CheckOU"
# Do something...
}
Else{
"Computer:$computerName is not in the OU:$CheckOU"
# Do something else..
}
This will take a $computerName and get all the OU's that it's in from Active Directory and stores them in an $OU array.

Then you can use that array to simply check if the computer is in the given OU ($CheckOU) or not by using the -match operator.

Best regards,
Simon


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
https://docs.microsoft.com/en-us/answers/articles/67444/email-notifications.html


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.