I have following Power shell script which works when I run from windows computer but when run including in CI/CD process throws error:
#[CmdletBinding()]
#param
#(
# [string]$connectionString #The connection string as per CRM Sdk
#)
#$tenantName=read-Host "Tenant Name (https://{TenantName}.crm6.dynamics.com)"
#$userName=Read-Host "Login name"
#$password=Read-Host "Password"
<#
$modules=Get-Module -ListAvailable -Name Xrm.Framework.CI.PowerShell.Cmdlets | Where-Object {$_.Version.Major -eq 9}
if($modules -eq $null -or $modules.Count -eq 0){
Write-Host "Module Xrm.Framework.CI.PowerShell.Cmdlets missing. Installing the module...."
Install-Module -Name Xrm.Framework.CI.PowerShell.Cmdlets
}
$module = Get-Module -Name Xrm.Framework.CI.PowerShell.Cmdlets
if($module -eq $null){
Write-Host "Importing Module..."
Import-Module -Name Xrm.Framework.CI.PowerShell.Cmdlets
}
#>
$connectionString="AuthType=Office365;Url=https://test.crm6.dynamics.com;UserName=tt@tt.com;Password=test122"
$ErrorActionPreference = "Stop"
#Script Location
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
Write-Verbose "Script Path: $scriptPath"
Write-Host "ConnectionString = $connectionString"
& "$scriptPath\lib\ExtractCustomizations.ps1" -Verbose -solutionPackager "$scriptPath\lib\SolutionPackager.exe" -solutionFilesFolder "$scriptPath\SolutionPackages\package" -mappingFile "$scriptPath\SolutionPackages\Mapping.xml" -solutionName "MySolution" -connectionString $connectionString -TreatPackWarningsAsErrors $false<p> </p><p>what I am doing wrong in this script? </p>


Report
All responses (
Answers (