I am attempting to generate webpages using the Razor Engine. I want to allow the user to be able to launch that webpage on their local device browser while in the session. I am having a very hard time finding a logical way to get this task completed. It seems that the Invoke-Item when placed into the ps1 script is running on the server, but not returning the browser to the client-side device.
function Get-File{ param( [Parameter(Mandatory=$true,HelpMessage='Please enter a valid Detonation ID')][string]$p ) If($p -match '[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}') { $fileResult= Invoke-WebRequest -Uri https://url.com/rapi/file/$p/file-WebSession $currentsession # End API Call Write-Verbose -Message 'Displaying File in web page....' # Create Web Page $fileString= $fileResult.RawContent $template = Get-Content -Path '\\p-servera\D$\Web Templates\filetemplate.htm' $model = New-Object -TypeName RazorEngine.Templating.DynamicViewBag $model.AddDictionaryValues(@{File= $fileString}) [RazorEngine.Razor]::Parse($template, $model) | Out-File -FilePath $env:TEMP\file.htm } else { Write-Warning -Message 'Please enter a valid Detonation UUID' } } }The razor engine takes care of all of the templating my issue is getting the template to launch in a client-side browser while in a remote PS Session.