Sokoban Posted May 14, 2021 Report post Posted May 14, 2021 (edited) Selcted OU will copy the files I want my selected OU will copy files to WMS folder in the desktop. And here is the selected OU choose the filepath. How will I do that ? Edited May 17, 2021 by Sokoban Quote Share this post Link to post Share on other sites More sharing options...
anyweb Posted May 15, 2021 Report post Posted May 15, 2021 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 Quote Share this post Link to post Share on other sites More sharing options...
Sokoban Posted May 16, 2021 Report post Posted May 16, 2021 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 ? Quote Share this post Link to post Share on other sites More sharing options...
anyweb Posted May 16, 2021 Report post Posted May 16, 2021 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 Quote Share this post Link to post Share on other sites More sharing options...
Sokoban Posted May 17, 2021 Report post Posted May 17, 2021 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 Quote Share this post Link to post Share on other sites More sharing options...
anyweb Posted May 17, 2021 Report post Posted May 17, 2021 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 Quote Share this post Link to post Share on other sites More sharing options...
Sokoban Posted May 19, 2021 Report post Posted May 19, 2021 Sorry , I don't understand your explanation, Something like that ? Can you send my link or something, that showing the process ? Quote Share this post Link to post Share on other sites More sharing options...