Skip to content

Commit

Permalink
Do not call .NET methods to enable use on CLM (PowerShell#1564)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapatwardhan authored and alerickson committed Apr 2, 2024
1 parent 20d6121 commit ed08d3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/code/ServerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using Microsoft.PowerShell.PSResourceGet.UtilClasses;
using System.Collections;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Net;
Expand All @@ -14,7 +15,7 @@ static UserAgentInfo()
{
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace))
{
_psVersion = ps.AddScript("$PSVersionTable.PSVersion.ToString()").Invoke<string>()[0];
_psVersion = ps.AddScript("$PSVersionTable").Invoke<Hashtable>()[0]["PSVersion"].ToString();
}

_psResourceGetVersion = typeof(UserAgentInfo).Assembly.GetName().Version.ToString();
Expand Down

0 comments on commit ed08d3f

Please sign in to comment.