{"id":746,"date":"2012-01-14T11:37:37","date_gmt":"2012-01-14T16:37:37","guid":{"rendered":"http:\/\/enterpriseadmins.org\/blog\/?p=746"},"modified":"2012-01-14T11:37:37","modified_gmt":"2012-01-14T16:37:37","slug":"powershell-title-bar-and-profile","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/powershell-title-bar-and-profile\/","title":{"rendered":"Powershell title bar and profile"},"content":{"rendered":"<p>This is a very simple post, but it shows how to make the Powershell title bar contain useful information.  By default the Powershell title contains the path to the powershell.exe file &#8212; here is an example:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2012\/01\/titlebar.png\" alt=\"\" title=\"titlebar\" width=\"459\" height=\"25\" \/><\/p>\n<p>To make this more useful, I&#8217;ve added a line to my powershell profile that looks like this:<\/p>\n<pre>$host.ui.rawui.WindowTitle=\"PowerShell $($psversiontable.psversion) as $($env:username)\"<\/pre>\n<p>*Note: all this text should appear on the same line in your profile.<\/p>\n<p>This change adds the Powershell version number and running user name to the title bar.  This is useful in my environment because I often have the need to run Powershell as a different user.  Here is an example of  the update:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2012\/01\/titlebar2.png\" alt=\"\" title=\"titlebar2\" width=\"171\" height=\"25\" \/><\/p>\n<p>I placed this in the all users profile located here:<\/p>\n<pre>%windir%\\system32\\WindowsPowerShell\\v1.0\\profile.ps1 <\/pre>\n<p>This profile is machine specific and executes anytime you open a powershell console for any user.  While you have the profile open, I have one more time saving suggestion.  If you use the Send-MailMessage cmdlet often, add this line:<\/p>\n<pre>$PSEmailServer = \"smtp-relay.mydomain.local\"<\/pre>\n<p>With this variable specified, you no longer need the &#8220;-SmtpServer&#8221; attribute to send a message &#8212; this global variable will automatically be used.<\/p>\n<p>Hope this helps!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a very simple post, but it shows how to make the Powershell title bar contain useful information. By default the Powershell title contains the path to the powershell.exe file &#8212; here is an example: To make this more &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/powershell-title-bar-and-profile\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"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,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-746","post","type-post","status-publish","format-standard","hentry","category-scripting"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=746"}],"version-history":[{"count":7,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/746\/revisions"}],"predecessor-version":[{"id":874,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/746\/revisions\/874"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}