Skip to content

Instantly share code, notes, and snippets.

@SoulOfUniverse
Created July 13, 2021 19:00
Show Gist options
  • Save SoulOfUniverse/e99bef5051899fd52dad23297cd4f469 to your computer and use it in GitHub Desktop.
Save SoulOfUniverse/e99bef5051899fd52dad23297cd4f469 to your computer and use it in GitHub Desktop.
Visual Studio Remote Sitecore Powershell Extension
<#
Set-ExecutionPolicy RemoteSigned
#>
Import-Module -Name SPE
$session = New-ScriptSession -Username remoteadmin -Password test -ConnectionUri https://sitecoreinstance.local
$jobId = Invoke-RemoteScript -ScriptBlock {
Write-Verbose ("Started at " + [System.DateTime]::Now)
$files = Get-ChildItem $SitecoreLogFolder
$files | sort LastWriteTime | select -last 10 #| Get-Content -Tail 100
Write-Verbose "#### next ####" -ForegroundColor Yellow
$files | Where-Object {$_.Name -like "log*"} | sort LastWriteTime | select -last 1 | Get-Content -Tail 200
Write-Verbose ("Finished at " + [System.DateTime]::Now)
} -AsJob -Session $session -Verbose
Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 1 -Debug -Verbose
Stop-ScriptSession -Session $session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment