Small tip for working with dashboards in IIS remotly

I like to develop locally, and became tired of copying the files from my local repo to the server, and then restarting the site.
In all my files (pages a seperate files) I added the snippet below.
The comment block allows me to quickly select and Hit F8 to then 1. Copy the file to its destination on the server, and 2. Restart the apppool to load the new file.

<#

Copy-Item PATH/TO/SOURCEFILE -Destination \\Server\c$\inetpub\Dashboard -Force
Invoke-Command -ComputerName IISServer.Domain.com -ScriptBlock {
    Restart-WebAppPool -Name Beta.Dashboard
}

#>
1 Like

you can also connect to a remote host natively via SSH and the VSCode Remote-SSH extension, so you edit the files directly on the server from your computer over ssh
extension ID:
ms-vscode-remote.remote-sshPreview

Alternately, Copy-Item has a -ToSession parameter that accepts a CIM Session so you could copy files over WinRM as well.

1 Like

VSCode has never been anything other than unstable for my powershell needs :frowning:

All of my page endpoints are a single line of code which dot references a script. I can replace any page script at any time with no need to restart the app pool.

And for when I do need to restart the app pool, I have an admin page where I can see and restart them.

Thanks,
Tim Curwick

Really? I use it exclusively and never have issues…