Issue running remote reinstall script

I’m having an issue running a remote reinstall command. The command sucessfully copies the files, but i’m having an issue running the script from within the command to start the batch file as an admin using powershell. Here is my code:

$Cred= get-credential
get-content -path c:\scripts\compsccm.csv|
foreach-object{
try
{Copy-item -path "\\370-s00nas\software\01 - Base User Install\SCCMClient" -recurse -Destination "\\$_\c$\" -passthru -force
foreach-object{
    write-host "Beginning scripted reinstall on $_" -foregroundcolor green
invoke-command -computername $_  -credential $Cred -scriptblock {set-location "c:\sccmclient"|start-process powershell.exe "c:\sccmclient\sccmreinstallremote.ps1" -verb runas
}}
}
catch
{add-content  -path "c:\scripts\testing\Unavailablecomputerssccm.csv" -notypeinformation -append }}

… having an issue? What does that mean? Why don’t you use the SCCM mechanism to reinstall the client?

And BTW: Guide to Posting Code

By having an issue i mean when i run the script, after i give it some time i check the log and the date hasnt changed, so i dont think the script is actually reinstalling anything. The files do copy though.

 

I could reinstall it from the console, but we get a list of computers every week that dont have the client installed, i figured importing the list into powershell and running the command would be quicker than manually searching through 800+ computernames to find the ones on the list