I am running a Powershell Script using Sitecore Powershell Module remoting service to install .update packages from my host to a remote Sitecore instance but I am not getting any details back on the package installation....

this is my script:

[string]$SitecoreInstanceUri = "http://SitecoreTestInstance",
[string]$SitecorePackagePath = "C:\test\AllLocalUpdatePackages",
[string]$UpgradeAction = "Upgrade",
[string]$InstallMode = "Install",
[string]$SitecoreAdminUser = "admin",
[string]$SitecoreAdminUserPassword = "b",
[array]$UpdatePackages = @("ASF.Main.Core")

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
import-Module -Name SPE

#find the real path of the package based on the partial package path given  
$UpdatePackages | ForEach-Object -Process {

try {

    $pattern = $_ + "*"
    $packagePath = ($SitecorePackagePath | Get-ChildItem -Include $pattern - 

    $parameters = @{"Path" = $packagePath.FullName; "UpgradeAction" = 
    $UpgradeAction; "InstallMode" = $InstallMode }
    $session = New-ScriptSession  -Username $SitecoreAdminUser -Password 
    $SitecoreAdminUserPassword -ConnectionUri $SitecoreInstanceUri -Timeout 
    #Install Package
    Write-verbose "Installing Sitecore update Package 
    $($packagePath.FullName) on $($SitecoreInstanceUri)" -verbose

    $jobId = Invoke-RemoteScript -Session $session -ScriptBlock {
        $ErrorActionPreference = "Stop"

        try {
            Install-UpdatePackage -Path $(($using:parameters).Path) - 
            UpgradeAction $(($using:parameters).UpgradeAction) -InstallMode 
            $(($using:parameters).InstallMode) | Select-Object -Property 

            $package = ($using:parameters).Path
        catch {
            $errorMessage = $_
            Write-Verbose "Following error occured when installing 
            $($package) : $($errorMessage)"

    } -AsJob -Verbose 

    #Query the job status to see if the item install is done 
    Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 5 -Verbose                 

catch {
    $ErrorMessage = $_.Exception.Message
    Write-verbose $ErrorMessage
    Write-Host "Issue Occured with this particular package"

1 Answer 1


It looks like you are missing a parameter on your Write-Verbose calls. If you look at the documentation (https://doc.sitecorepowershell.com/remoting), the example calls Write-Verbose like this:

Write-Verbose "Hello from the other side" -Verbose 4>&1

You can make this neater by overriding the Write-Verbose function in your script block like this:

Invoke-RemoteScript -ScriptBlock {
    function Write-Verbose {
        Microsoft.PowerShell.Utility\Write-Verbose -Message $Message -Verbose 4>&1

    Write-Verbose "Hello from the other side"
    Write-Verbose "Goodbye from the other side"
} -Session $session

Unfortunately the link to the information about 4>&1 is missing, but you can try that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.