Author Posts

December 16, 2013 at 6:44 am

Running this script...

 $erroractionpreference = “Stop”
 $servers = Get-Content -path C:\symantecinstallation\reports\WEBDEV.csv
 foreach ($server in $servers){
 $server
 $os = (Get-WmiObject -computername $server -class Win32_OperatingSystem ).osarchitecture
  If ($os -eq “64-bit”) {
 Write-host "running 64 $server"
 $arSourceFolders1 = ("\\snappsepp03s\sep_clients\msi\My Company_2 Mid-West_Servers_STL_Co-Lo_Web Dev Servers_WIN64BIT_Server\Symantec Endpoint Protection version 12.1.2015.2015 - English")
 $arDestinationFolders1 = ("\\$server\C$\Windows\Temp\Symantec Endpoint Protection version 12.1.2015.2015 - English")
 $cmd1 = robocopy $arSourceFolders1 $arDestinationFolders1 /MIR /XA:SH /ipg:0 /w:0 /log:c:\symantecInstallation\robocopy\robocopy_"$server"log.txt
 start-process $cmd1 -Wait
 Write-Host "Copy 64bit Symantec Install Complete $server"
     Invoke-Command -Computername $server -ScriptBlock {
$msifile= 'msiexec /i C:\windows\temp\Symantec Endpoint Protection version 12.1.2015.2015 - English\sep64.msi' 
$arguments= ' /qn SYMREBOOT=ReallySuppress /l*v C:\windows\Temp\sep.log' 
Start-Process `
     -file  $msifile `
     -arg $arguments `
     -passthru | wait-process}

I get the following error?

Start-Process : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'FilePath'. Specified method is not supported.
At C:\SymantecInstallation\Symantecinstallerworkinprogress.ps1:11 char:16
+ start-process $cmd1 -Wait
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.StartProcessCommand

though the copy command is working?

December 16, 2013 at 11:10 am

$arSourceFolders1 = ("\\snappsepp03s\sep_clients\msi\My Company_2 Mid-West_Servers_STL_Co-Lo_Web Dev Servers_WIN64BIT_Server\Symantec Endpoint Protection version 12.1.2015.2015 – English")
$arDestinationFolders1 = ("\\$server\C$\Windows\Temp\Symantec Endpoint Protection version 12.1.2015.2015 – English")
$cmd1 = robocopy $arSourceFolders1 $arDestinationFolders1 /MIR /XA:SH /ipg:0 /w:0 /log:c:\symantecInstallation\robocopy\robocopy_"$server"log.txt
start-process $cmd1 -Wait

Your error is in these lines I think. Try removing the () from round the file paths in $arSourceFolders1 & $arDestinationFolders1

December 16, 2013 at 4:06 pm

This line is a problem:

$cmd1 = robocopy $arSourceFolders1 $arDestinationFolders1 /MIR /XA:SH /ipg:0 /w:0 /log:c:\symantecInstallation\robocopy\robocopy_"$server"log.txt

You're not creating a string there, you're executing the command. $cmd1 will contain an array of strings which are the output from robocopy. Here's what I think you probably intended:

$arguments = "$arSourceFolders1 $arDestinationFolders1 /MIR /XA:SH /ipg:0 /w:0 /log:c:\symantecInstallation\robocopy\robocopy_${server}log.txt"
Start-Process -FilePath robocopy.exe -ArgumentList $arguments -Wait

I'm not sure what the advantage is to using Start-Process here, though. As you've pointed out, robocopy is working fine when you just run the command.