Skip to content

Commit 96f5e47

Browse files
committed
Write host and PowerShell versions to log file
This change adds helpful log messages to identify the version of both the host and the PowerShell runtime on the local machine.
1 parent 3044b62 commit 96f5e47

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/PowerShellEditorServices.Host/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,15 @@ static void Main(string[] args)
9494
}
9595
#endif
9696

97-
Logger.Write(LogLevel.Normal, "PowerShell Editor Services Host starting...");
97+
FileVersionInfo fileVersionInfo =
98+
FileVersionInfo.GetVersionInfo(
99+
System.Reflection.Assembly.GetExecutingAssembly().Location);
100+
101+
Logger.Write(
102+
LogLevel.Normal,
103+
string.Format(
104+
"PowerShell Editor Services Host v{0} starting...",
105+
fileVersionInfo.FileVersion));
98106

99107
// Start the server
100108
server.Start();

src/PowerShellEditorServices/Session/PowerShellContext.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,15 @@ private void Initialize(Runspace initialRunspace)
130130
// TODO: Should this be configurable?
131131
this.SetExecutionPolicy(ExecutionPolicy.RemoteSigned);
132132

133-
PowerShellVersion = GetPowerShellVersion();
133+
// Get the PowerShell runtime version
134+
this.PowerShellVersion = GetPowerShellVersion();
135+
136+
// Write out the PowerShell version for tracking purposes
137+
Logger.Write(
138+
LogLevel.Normal,
139+
string.Format(
140+
"PowerShell runtime version: {0}",
141+
this.PowerShellVersion));
134142

135143
#if !PowerShellv3
136144
if (PowerShellVersion > new Version(3,0))

0 commit comments

Comments
 (0)