Created
July 1, 2023 15:34
-
-
Save ElakkuvanR/b90d731f47750dae999f70c58c6248af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create session and log to Sitecore | |
[CmdletBinding(DefaultParameterSetName = "no-arguments")] | |
Param ( | |
[Parameter(Mandatory = $true, HelpMessage = "The remote CM URL")] | |
[string]$remoteCMUrl, | |
[Parameter(Mandatory = $true, HelpMessage = "User name under PSE Security Group")] | |
[string]$username, | |
[Parameter(Mandatory = $true, HelpMessage = "Password")] | |
[string]$password, | |
[Parameter(Mandatory = $true, HelpMessage = "Source File Path")] | |
[string]$sourceFilePath, | |
[Parameter(Mandatory = $true, HelpMessage = "Destination File Path")] | |
[string]$destinationFilePath | |
) | |
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force | |
Import-Module -Name ./SPE | |
try { | |
$session = New-ScriptSession -ConnectionUri $remoteCMUrl -Username $username -Verbose -Password $password | |
Write-Host 'Started uploading the File' | |
Send-RemoteItem -Session $session -Path $sourceFilePath -Destination "C:\inetpub\wwwroot\App_Data\packages\$($destinationFilePath)" | |
Write-Host 'Ended uploading the File' | |
} | |
catch { | |
Write-Host $_.Exception | |
exit | |
} finally { | |
Stop-ScriptSession -Session $session | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment