Here is my code
[CmdletBinding()]
Param (
[Parameter(Mandatory=$false)]
[ValidateSet(‘Install’,‘Uninstall’)]
[string]$DeploymentType = ‘Install’,
[Parameter(Mandatory=$false)]
[ValidateSet(‘Interactive’,‘Silent’,‘NonInteractive’)]
[string]$DeployMode = ‘Interactive’,
[Parameter(Mandatory=$false)]
[switch]$AllowRebootPassThru = $false,
[Parameter(Mandatory=$false)]
[switch]$TerminalServerMode = $false,
[Parameter(Mandatory=$false)]
[switch]$DisableLogging = $false
)
Try {
## Set the script execution policy for this process
Try { Set-ExecutionPolicy -ExecutionPolicy ‘ByPass’ -Scope ‘Process’ -Force -ErrorAction ‘Stop’ } Catch {}
##*===============================================
##* VARIABLE DECLARATION
##*===============================================
## Variables: Application
[string]$appVendor = 'Microsoft'
[string]$appName = 'Office 365 2016'
[string]$appVersion = ''
[string]$appArch = ''
[string]$appLang = 'EN'
[string]$appRevision = ''
[string]$appScriptVersion = ''
[string]$appScriptDate = '20/02/2017'
[string]$appScriptAuthor = 'Azola'
##*===============================================
## Variables: Install Titles (Only set here to override defaults set by the toolkit)
[string]$installName = ''
[string]$installTitle = ''
##* Do not modify section below
#region DoNotModify
## Variables: Exit Code
[int32]$mainExitCode = 0
## Variables: Script
[string]$deployAppScriptFriendlyName = 'Deploy Application'
[version]$deployAppScriptVersion = [version]'3.6.8'
[string]$deployAppScriptDate = '02/06/2016'
[hashtable]$deployAppScriptParameters = $psBoundParameters
## Variables: Environment
If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
[string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent
## Dot source the required App Deploy Toolkit Functions
Try {
[string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
}
Catch {
If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: <code>n$($_.Exception.Message)</code>n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
## Exit the script, returning the exit code to SCCM
If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
}
#endregion
##* Do not modify section above
##*===============================================
##* END VARIABLE DECLARATION
##*===============================================
If ($deploymentType -ine 'Uninstall') {
##*===============================================
##* PRE-INSTALLATION
##*===============================================
[string]$installPhase = 'Pre-Installation'
## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
Show-DialogBox -Title 'Installazione Office 365 2016' -text "Attenzione l'Office 365 installato sul tuo pc sta per essere aggiornato alla versione 2016, chiudi tutte le applicazioni Office prima di procedere" -Icon 'Information'
Show-InstallationWelcome -CloseApps 'outlook,excel,winword,visio,' -AllowDefer -DeferTimes 3
## Show Progress Message (with the default message)
Show-InstallationProgress
##*===============================================
##* INSTALLATION
##*===============================================
[string]$installPhase = 'Installation'
## <Perform Installation tasks here>
$visio = 'C:\Program Files\Microsoft Office 15\root\office15\VISIO.EXE'
$Project = 'C:\Program Files\Microsoft Office 15\root\office15\WINPROJ.EXE'
$x64 = Get-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\Word'
If ($x64 -eq $null)
{
## Disinstalla Tutto e Installa O365 2016 x86 e Visio e Project
If((test-path $visio) -and (test-path $Project))
{
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2013\setup.exe' -parameter '/configure \\fs011nas\0a31ops-software_center\MSOffice\O365\Office2013\UninstallAll.xml'
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Project2016\setup.exe' -parameter '/configure \\fs011nas\0a31ops-software_center\MSOffice\O365\Project2016\Install.xml'
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Visio2016\setup.exe' -parameter '/configure \\fs011nas\0a31ops-software_center\MSOffice\O365\Visio2016\Install.xml'
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2016\updfrom2013.bat'
}
## Disinstalla Tutto e Installa O365 2016 x86 e Visio
If(test-path $visio)
{execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2013\setup.exe /configure \\fs011nas\0a31ops-software_center\MSOffice\O365\Office2013\UninstallAll.xml'
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Visio2016\setup.exe /configure \\fs011nas\0a31ops-software_center\MSOffice\O365\Visio2016\Install.xml'
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2016\updfrom2013.bat'
}
## Disinstalla Tutto e Installa O365 2016 x86 e Project
If(test-path $Project)
{execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2013\setup.exe /configure \\fs011nas\0a31ops-software_center\MSOffice\O365\Office2013\UninstallAll.xml'
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Project2016\setup.exe /configure \\fs011nas\0a31ops-software_center\MSOffice\O365\Project2016\Install.xml'
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2016\updfrom2013.bat'
}
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2016\updfrom2013.bat'
execute-process -path "\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2016\InstallProof2016x86.bat"
}
Else
{
## Installa O365 2016 x64
execute-process -path '\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2016x64\updfrom2013.bat'
execute-process -path "\\fs011nas\0a31ops-software_center\MSOffice\O365\Office2016\InstallProof2016x64.bat"
}
Copy-File -Path "\\fs854nas\0a31ops-software_center\MSOffice\O365\PsLoggedon.exe" -Destination "$envTemp\PsLoggedon.exe"
Copy-File -Path "\\fs854nas\0a31ops-software_center\MSOffice\O365\CheckO365Installation.bat" -Destination "$envTemp\CheckO365Installation.bat"
execute-process -path "$envTemp\CheckO365Installation.bat"
##*===============================================
##* END SCRIPT BODY
##*===============================================
## Call the Exit-Script function to perform final cleanup operations
Exit-Script -ExitCode $mainExitCode
}
}
Catch {
[int32]$mainExitCode = 60001
[string]$mainErrorMessage = “$(Resolve-Error)”
Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
Show-DialogBox -Text $mainErrorMessage -Icon ‘Stop’
Exit-Script -ExitCode $mainExitCode
}
The log says that:
Installation] :: Function failed, setting exit code to [60002].
Error Record:
Message : File [\fs011nas\0a31ops-software_center\MSOffice\O365\Office2
013\setup.exe] not found.
InnerException :
FullyQualifiedErrorId : File [\fs011nas\0a31ops-software_center\MSOffice\O365
Office2013\setup.exe] not found.
PositionMessage :
At \fs854nas\0a31ops-software_center\MSOffice\O365\AppDeploy
Toolkit\AppDeployToolkitMain.ps1:2697 char:11
+ Throw <<<< “File [$Path] not found.”
Any help?
The file allready exists