Posts

Showing posts from April, 2024

Powershell script for VS build and deploy

$solutionName = "$PSScriptRoot/SWSC.sln" dotnet restore $solutionName function Get-MsBuildPath() { $vsWherePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" if ((Test-Path $vsWherePath) -eq $false) { throw "It seems you have no Visual Studio installed. You won't be able to build the solution without it." } $path = &"$vsWherePath" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe if ($path.Length -eq 0) { throw "No MSBuild can be found. Make sure you have Visual Studio installed." } return $path } $msBuildPath = Get-MsBuildPath $buildToPaths = @("$PSScriptRoot/docker/deploy/cm") $buildToPaths | ForEach-Object { Write-Host "[$((Get-Date).ToString("hh:mm:ss"))] Building the backend code to $_..." -ForegroundColor Yellow &$msBuildPath $solutionName "...

Read and export Sitecore item fields using powershell.

 $database = "master" $root = Get-Item -Path (@{$true="$($database):\content\ExactSciences\Websites\Cologuard\Cologuard\Settings\Redirects"; false="$($database):\content\ExactSciences\Websites\Cologuard\Cologuard\Settings\Redirects"}[(Test-Path -Path "$($database):\content\ExactSciences\Websites\Cologuard\Cologuard\Settings\Redirects")]) $props = @{     Parameters = @(         @{Name="root"; Title="Choose the report root"; Tooltip="Only items from this root will be returned."; })     Title = "Export Lists all content items and media items"     Description = "Choose the criteria for the report."     Width = 550     Height = 300     ShowHints = $true } $result = Read-Variable @props if($result -eq "cancel") {     exit } $templateId="{F4FB6125-F113-4373-8AA2-4648C2C1960E}" $items = Get-ChildItem -Path $root.ProviderPath -Recurse | Where-Object { $_.TemplateId -eq $templateId } if(...

Target Machine Actively refused at - Invoke-RestMethod "http://localhost:xxx/api/http/routers

When I am running up.ps1 script while setting up my local to run XM Cloud, I'm getting the below error. Background: my system got restarted and after that am facing this issue, docker containers are in the exited state, and not able to restart. Tried fix: I completely deleted all my docker containers and ran up.ps1 script to install containers again and then the script was running fine. Docker installed: docker for windows and running in windows containers Error: strconv.Atoi: parsing "": invalid syntax Waiting for CM to become available... Invoke-RestMethod: C:\pathtoxmcloudproject\up.ps1:59:19 Line | 59 | … $status = Invoke-RestMethod "http://localhost:xxxx/api/http/routers … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | No connection could be made because the target machine actively refused it. I tried deleting all containers and re-running the up.ps1 script. ==================================================== ...