Powershell and robocopy

Hi Experts,

is there any way to ascertain if a robocopy call in Powershell support the /MT:n switch before running robocopy. Remember robocopy before Windows 2008 R2 Server have no /MT Switch.
$LASTEXITCODE give only "success" or "fail" (ERRORLEVEL) but not if the robocopy Version support the switch.


reredokIT ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

reredokIT ConsultantAuthor Commented:
got it:
if ($version_Major -le 6) {
    if($version_Minor -eq 0) {
        $Windows_2008_Server = $true
    } # if
    else {
        if ($version_Minor -gt 0) {
            $Windows_2008_Server = $false 
            }# if
    } # else
} # if

Open in new window

depending on !($Windows_2008_Server) you can set /MT Switch for newer OS like Windows 2008 Server

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
There could be a more recent Robocopy somewhere copied to the system, but yes, the OS release check should work in general. Parsing e.g. robocopy help would be more reliable, though.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.