{"id":7257,"date":"2020-02-13T09:29:07","date_gmt":"2020-02-13T14:29:07","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7257"},"modified":"2021-04-20T09:57:56","modified_gmt":"2021-04-20T13:57:56","slug":"cross-platform-powershell-profiles-with-windows-terminal","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/","title":{"rendered":"Cross Platform PowerShell Profiles with Windows Terminal"},"content":{"rendered":"\n<p>Earlier this week I <a title=\"revisit the original article\" href=\"https:\/\/jdhitsolutions.com\/blog\/?p=7242\" target=\"_blank\" rel=\"noopener noreferrer\">shared my techniques<\/a> for creating a Windows Terminal profile that would open a remote PowerShell session. But with PowerShell 7, I can also connect to non-Windows machines using SSH. So why not extend my code to allow connecting to a Linux box? Before you try anything that I'm going to share, make sure you can manually create and enter a PSSession to your Linux target using SSH. If you can do that, then you can create a Windows Terminal profile.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">The Connection Script<\/h2>\n\n\n\n<p>I modified my existing script to create the remoting session. Because I'll have to invoke <em>pwsh<\/em> instead of <em>powershell<\/em>, I could have created a second script with the proper parameters.&nbsp; But then I'd have to scripts to maintain. So instead, I modified my wtpsremote.ps1 script and used parameter sets.<\/p>\n\n\n\n<figure class=\"wp-block-image is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image-9.png\"><img decoding=\"async\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-9.png\" alt=\"wtpsremote.ps1 help\" title=\"wtpsremote.ps1 help\"\/><\/a><\/figure>\n\n\n\n<p>I've updated the script to also include verbose messages which help when troubleshooting. And better error handling.<\/p>\n\n\n\n<pre title=\"wtpsremote.ps1\" class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">#requires -version 5.1\n\n&lt;#\n.Synopsis\nCreate a remote PowerShell session\n.Description\nThis script is intended to be called from a Windows Terminal profile to create\na PowerShell remoting session. If you are using the ssh parameter set, you \nwill need to invoke this script with pwsh.\n.Link\nNew-PSSession\n.Link\nEnter-PSSession\n#>\n\n[cmdletbinding(DefaultParameterSetName = \"Computer\")]\nParam(\n    [Parameter(Position = 0, Mandatory, HelpMessage = \"Specify remote computer name\",ParameterSetName=\"Computer\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$Computername,\n    [Parameter(ParameterSetName=\"Computer\")]\n    [pscredential]$Credential,\n    [Parameter( HelpMessage = \"A profile script to run in the remote session\")]\n    [ValidateScript( {Test-Path $_})]\n    [string]$RemoteProfile,\n    [Parameter(HelpMessage = \"Specify a remote endpoint other than the default Microsoft.powershell\")]\n    [string]$ConfigurationName,\n    [Parameter(HelpMessage = \"Specify an alternate port number\")]\n    [int32]$Port,\n    [Parameter(ParameterSetName=\"Computer\")]\n    [switch]$UseSSL,\n    [Parameter(Position = 0, Mandatory,ParameterSetName = \"ssh\")]\n    [ValidateNotNullorEmpty()]\n    [string]$Hostname,\n    [Parameter(ParameterSetName = \"ssh\")]\n    [string]$Username,\n    [Parameter(ParameterSetName = \"ssh\")]\n    [string]$Subsystem,\n    [Parameter(ParameterSetName = \"ssh\")]\n    [string]$KeyFilePath\n)\n\nWrite-Verbose \"Starting $($MyInvocation.MyCommand)\"\nWrite-Verbose \"Using parameter set $($pscmdlet.parametersetname)\"\nif ($PSCmdlet.ParameterSetName -eq \"ssh\") {\n    Write-Verbose \"adding SSHTransport parameter\"\n    [void]($PSBoundParameters.add(\"SSHTransport\",$True))\n}\n#remove this this parameter if specified since it can't be used to create a new PSSession\nif ($PSBoundParameters.ContainsKey(\"RemoteProfile\")) {\n    Write-Verbose \"Removing RemoteProfile bound parameter\"\n    [void]($PSBoundParameters.Remove(\"RemoteProfile\"))\n}\n\n#Create a new remoting session splatting the parameters passed to this script\nTry {\n    Write-Verbose \"Using these parameters to create the PSSession\"\n    $PSBoundParameters | Out-String | Write-Verbose\n    $remote = New-PSSession @PSBoundParameters -errorAction Stop\n    $remote | Out-String | Write-Verbose\n}\nCatch {\n    Write-Verbose \"Failed to create remoting session\"\n    Throw $_\n}\n#run the remote profile script\nif ($RemoteProfile) {\n    Write-Verbose \"Running remote profile script $RemoteProfile\"\n    Invoke-Command -Session $remote -FilePath $RemoteProfile -HideComputerName |\n    Select-Object -property * -ExcludeProperty runspaceID\n}\n\n#open the pssession\nWrite-Verbose \"Entering session\"\nEnter-PSSession -session $remote\n\n$msg = @\"\n-------------------------------------------------------------------------------------\n| Reminder:                                                                         |\n| Remove the `$remote pssession after you exit and before you close the profile tab. |\n|                                                                                   |\n| PS C:\\> `$remote | Remove-PSSession                                                |\n| PS C:\\> exit                                                                      |\n-------------------------------------------------------------------------------------\n\n\"@\n\n#you may need to adjust colors based on your profile settings\nWrite-host $msg -ForegroundColor Magenta -BackgroundColor Gray\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">The Windows Terminal Profile<\/h2>\n\n\n\n<p>With this script I can create a Windows Terminal profile for my Linux session.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp;&nbsp;&nbsp;&nbsp;\"acrylicOpacity\":&nbsp;0.8,\n&nbsp;&nbsp;&nbsp;&nbsp;\"closeOnExit\":&nbsp;true,\n&nbsp;&nbsp;&nbsp;&nbsp;\"colorScheme\":&nbsp;\"Campbell\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"commandline\":&nbsp;\"C:\\\\Program&nbsp;Files\\\\PowerShell\\\\7-preview\\\\preview\\\\pwsh-preview.cmd&nbsp;-nologo&nbsp;-noprofile&nbsp;-noexit&nbsp;-file&nbsp;c:\\\\scripts\\\\wtpsremote.ps1&nbsp;-hostname&nbsp;fred-company-com&nbsp;-username&nbsp;jeff&nbsp;-remoteprofile&nbsp;c:\\\\scripts\\\\lxprofile.ps1\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"cursorColor\":&nbsp;\"#FFFFFF\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"cursorShape\":&nbsp;\"underscore\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"fontFace\":&nbsp;\"Cascadia&nbsp;Code\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"fontSize\":&nbsp;14,\n&nbsp;&nbsp;&nbsp;&nbsp;\"guid\":&nbsp;\"{5668446e-620a-448f-874b-db766831b2ab}\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"historySize\":&nbsp;9001,\n&nbsp;&nbsp;&nbsp;&nbsp;\"icon\":&nbsp;\"ms-appx:\/\/\/ProfileIcons\/{574e775e-4f2a-5b96-ac1e-a2962a402336}.png\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"name\":&nbsp;\"Fred\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"padding\":&nbsp;\"0,&nbsp;0,&nbsp;0,&nbsp;0\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"snapOnInput\":&nbsp;true,\n&nbsp;&nbsp;&nbsp;&nbsp;\"startingDirectory\":&nbsp;\"C:\\\\\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"tabTitle\":&nbsp;\"PSRemote:&nbsp;Fred\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundImage\":&nbsp;\"C:\\\\users\\\\jeff\\\\Pictures\\\\smoking-penguin.jpg\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundImageAlignment\":&nbsp;\"center\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundImageStretchMode\":&nbsp;\"none\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundImageOpacity\":&nbsp;0.3,\n&nbsp;&nbsp;&nbsp;&nbsp;\"useAcrylic\":&nbsp;true\n}<\/code><\/pre>\n\n\n\n<p>Eventually, I will update this profile to use the final path to <em>pwsh<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Linux Profile Script<\/h2>\n\n\n\n<p>I'm still offering the option to run a remote profile script. It is still a PSSession after all. This is the script file I use for my Linux connections.<\/p>\n\n\n\n<pre title=\"lxprofile.ps1\" class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"># this is for Linux based computers\n $os = $PSVersionTable.OS\n $lsb = lsb_release -d\n $osver = ($lsb -split \":\")[1].Trim()\n $elevated = \"N\/A\"\n $user = [System.Environment]::UserName\n $computer = [System.Environment]::MachineName\n #object properties will be displayed in the order they are listed here\n [pscustomObject]@{\n     User            = $user\n     Elevated        = $elevated\n     Computername    = $computer\n     OperatingSystem = $os\n     OSVersion       = $osver\n     PSVersion       = $PSVersionTable.PSVersion.ToString()\n     Edition         = $PSVersionTable.PSEdition\n     PSHost          = $host.Name\n     WSMan           = $PSVersionTable.WSManStackVersion.ToString()\n     ExecutionPolicy = (Get-ExecutionPolicy)\n     Culture         = [System.Globalization.CultureInfo]::CurrentCulture.NativeName\n }\n $initiated = Get-Date\n $remotePrompt = {\n     #display the session runtime without the milliseconds\n     $ts = ((Get-Date) - $initiated).ToString().split(\".\")[0]\n     Write-Host \"&gt;$ts&lt; \" -ForegroundColor yellow -nonewline     \"PS $($executionContext.SessionState.Path.CurrentLocation)$('&gt;' * ($nestedPromptLevel + 1)) \";\n }\n Set-Item -Path function:\\prompt -Value $remotePrompt -Force<\/code><\/pre>\n\n\n\n<p>I'm using the same prompt concept to show how long the session has been running. Here's the end result<\/p>\n\n\n\n<figure class=\"wp-block-image is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image-10.png\"><img decoding=\"async\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-10.png\" alt=\"My PowerShell remoting session to a Linux platform\" title=\"My PowerShell remoting session to a Linux platform\"\/><\/a><\/figure>\n\n\n\n<p>At this point, I can use Windows Terminal for all of my PowerShell remoting needs and have everything I need in one place. I hope you'll let me know what you think of these updates.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this week I shared my techniques for creating a Windows Terminal profile that would open a remote PowerShell session. But with PowerShell 7, I can also connect to non-Windows machines using SSH. So why not extend my code to allow connecting to a Linux box? Before you try anything that I&#8217;m going to share,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New Stuff! Cross Platform #PowerShell Profiles with Windows Terminal","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,615],"tags":[186,611,87,616],"class_list":["post-7257","post","type-post","status-publish","format-standard","hentry","category-powershell","category-windows-terminal","tag-linux","tag-powershell-7","tag-remoting","tag-windows-terminal"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Cross Platform PowerShell Profiles with Windows Terminal &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"I&#039;ve updated my PowerShell script to let me create a cross-platform remoting profile in Windows Terminal. Complete with a remote profile script.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cross Platform PowerShell Profiles with Windows Terminal &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve updated my PowerShell script to let me create a cross-platform remoting profile in Windows Terminal. Complete with a remote profile script.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-13T14:29:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-20T13:57:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-9.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Cross Platform PowerShell Profiles with Windows Terminal\",\"datePublished\":\"2020-02-13T14:29:07+00:00\",\"dateModified\":\"2021-04-20T13:57:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/\"},\"wordCount\":287,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/image_thumb-9.png\",\"keywords\":[\"Linux\",\"PowerShell 7\",\"remoting\",\"Windows Terminal\"],\"articleSection\":[\"PowerShell\",\"Windows Terminal\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/\",\"name\":\"Cross Platform PowerShell Profiles with Windows Terminal &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/image_thumb-9.png\",\"datePublished\":\"2020-02-13T14:29:07+00:00\",\"dateModified\":\"2021-04-20T13:57:56+00:00\",\"description\":\"I've updated my PowerShell script to let me create a cross-platform remoting profile in Windows Terminal. Complete with a remote profile script.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/image_thumb-9.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/image_thumb-9.png\",\"width\":1028,\"height\":562},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7257\\\/cross-platform-powershell-profiles-with-windows-terminal\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cross Platform PowerShell Profiles with Windows Terminal\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cross Platform PowerShell Profiles with Windows Terminal &#8226; The Lonely Administrator","description":"I've updated my PowerShell script to let me create a cross-platform remoting profile in Windows Terminal. Complete with a remote profile script.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/","og_locale":"en_US","og_type":"article","og_title":"Cross Platform PowerShell Profiles with Windows Terminal &#8226; The Lonely Administrator","og_description":"I've updated my PowerShell script to let me create a cross-platform remoting profile in Windows Terminal. Complete with a remote profile script.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-02-13T14:29:07+00:00","article_modified_time":"2021-04-20T13:57:56+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-9.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Cross Platform PowerShell Profiles with Windows Terminal","datePublished":"2020-02-13T14:29:07+00:00","dateModified":"2021-04-20T13:57:56+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/"},"wordCount":287,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-9.png","keywords":["Linux","PowerShell 7","remoting","Windows Terminal"],"articleSection":["PowerShell","Windows Terminal"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/","name":"Cross Platform PowerShell Profiles with Windows Terminal &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-9.png","datePublished":"2020-02-13T14:29:07+00:00","dateModified":"2021-04-20T13:57:56+00:00","description":"I've updated my PowerShell script to let me create a cross-platform remoting profile in Windows Terminal. Complete with a remote profile script.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-9.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-9.png","width":1028,"height":562},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Cross Platform PowerShell Profiles with Windows Terminal"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":7242,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7242\/powershell-remoting-profiles-with-windows-terminal\/","url_meta":{"origin":7257,"position":0},"title":"PowerShell Remoting Profiles with Windows Terminal","author":"Jeffery Hicks","date":"February 10, 2020","format":false,"excerpt":"I have jumped in the deep end and fully committed to Windows Terminal as my default PowerShell environment. I love having one interface with tabs for different terminal profiles. Windows Terminal makes it easy for me to have tabs open to PowerShell 7, Windows PowerShell, an Ubuntu instance or even\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-8.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-8.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-8.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/image_thumb-8.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8499,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8499\/using-the-powershell-ise-as-a-remote-management-console\/","url_meta":{"origin":7257,"position":1},"title":"Using the PowerShell ISE as a Remote Management Console","author":"Jeffery Hicks","date":"July 20, 2021","format":false,"excerpt":"Way back before the days of PowerShell Core, or even VS Code for that matter, the PowerShell ISE was the center of my PowerShell world. I spent a lot of time finding ways to make it easier for me to use and to push it to its limits. Naturally, the\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/ise-remotetab-form2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":7969,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-7\/7969\/deploy-openssh-server-to-windows-10\/","url_meta":{"origin":7257,"position":2},"title":"Deploy OpenSSH Server to Windows 10","author":"Jeffery Hicks","date":"December 16, 2020","format":false,"excerpt":"PowerShell 7 offers a number of compelling reasons to adopt it. One of the best is support for SSH as a PowerShell remoting protocol. Unfortunately, this is not a topic that typically comes up for Windows-centric IT Pros. I know this is definitely true in my case, and a deficiency\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7978,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/","url_meta":{"origin":7257,"position":3},"title":"Deploy OpenSSH to Windows Server","author":"Jeffery Hicks","date":"December 17, 2020","format":false,"excerpt":"Yesterday I shared some PowerShell ideas for remotely setting up the server component of ssh on a remote Windows 10 system. This would allow you to establish an ssh session to the desktop or even use PowerShell remoting over ssh. Next, we need to look at doing the same thing\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":5895,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5895\/another-look-at-powershell-core-version-information\/","url_meta":{"origin":7257,"position":4},"title":"Another Look at PowerShell Core Version Information","author":"Jeffery Hicks","date":"February 8, 2018","format":false,"excerpt":"As PowerShell Core begins to spread into our world, and as we start thinking about working and scripting cross-platform, it will be useful to know what type of platform you are running on. The built in $PSVersionTable is an obvious place to start. On PowerShell Core there are also some\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":7361,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/7361\/powershell-7-cross-platform-scripting-tips-and-traps\/","url_meta":{"origin":7257,"position":5},"title":"PowerShell 7 Cross-Platform Scripting Tips and Traps","author":"Jeffery Hicks","date":"March 13, 2020","format":false,"excerpt":"One of the reasons you want to adopt PowerShell 7 on your desktop, is that it can\u00a0 be used cross-platform. Theoretically, you can write a PowerShell script or function that works on Windows, Linux, and Mac. However, this is not without challenges. In some ways, it feels like we are\u2026","rel":"","context":"In &quot;PowerShell 7&quot;","block_context":{"text":"PowerShell 7","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-7\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/hicks-scripting-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/hicks-scripting-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/hicks-scripting-4.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/hicks-scripting-4.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7257"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7257\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}