@@ -102,17 +102,17 @@ function ExitWithError($errorString) {
102
102
}
103
103
104
104
function WriteSessionFile ($sessionInfo ) {
105
- $sessionInfoJson = ConvertTo-Json - InputObject $sessionInfo - Compress
105
+ $sessionInfoJson = Microsoft.PowerShell. Utility\ ConvertTo-Json - InputObject $sessionInfo - Compress
106
106
Log " Writing session file with contents:"
107
107
Log $sessionInfoJson
108
- $sessionInfoJson | Set-Content - Force - Path " $SessionDetailsPath " - ErrorAction Stop
108
+ $sessionInfoJson | Microsoft.PowerShell. Management\ Set-Content - Force - Path " $SessionDetailsPath " - ErrorAction Stop
109
109
}
110
110
111
111
# Are we running in PowerShell 2 or earlier?
112
112
if ($PSVersionTable.PSVersion.Major -le 2 ) {
113
113
# No ConvertTo-Json on PSv2 and below, so write out the JSON manually
114
114
" {`" status`" : `" failed`" , `" reason`" : `" unsupported`" , `" powerShellVersion`" : `" $ ( $PSVersionTable.PSVersion.ToString ()) `" }" |
115
- Set-Content - Force - Path " $SessionDetailsPath " - ErrorAction Stop
115
+ Microsoft.PowerShell. Management\ Set-Content - Force - Path " $SessionDetailsPath " - ErrorAction Stop
116
116
117
117
ExitWithError " Unsupported PowerShell version $ ( $PSVersionTable.PSVersion ) , language features are disabled."
118
118
}
@@ -133,9 +133,9 @@ $isPS5orLater = $PSVersionTable.PSVersion.Major -ge 5
133
133
134
134
# If PSReadline is present in the session, remove it so that runspace
135
135
# management is easier
136
- if ((Get-Module PSReadline).Count -gt 0 ) {
136
+ if ((Microsoft.PowerShell. Core\ Get-Module PSReadline).Count -gt 0 ) {
137
137
LogSection " Removing PSReadLine module"
138
- Remove-Module PSReadline - ErrorAction SilentlyContinue
138
+ Microsoft.PowerShell. Core\ Remove-Module PSReadline - ErrorAction SilentlyContinue
139
139
}
140
140
141
141
# This variable will be assigned later to contain information about
@@ -146,7 +146,7 @@ $resultDetails = $null;
146
146
function Test-ModuleAvailable ($ModuleName , $ModuleVersion ) {
147
147
Log " Testing module availability $ModuleName $ModuleVersion "
148
148
149
- $modules = Get-Module - ListAvailable $moduleName
149
+ $modules = Microsoft.PowerShell. Core\ Get-Module - ListAvailable $moduleName
150
150
if ($modules -ne $null ) {
151
151
if ($ModuleVersion -ne $null ) {
152
152
foreach ($module in $modules ) {
@@ -182,7 +182,7 @@ function Test-PortAvailability {
182
182
$ipAddress = [System.Net.IPAddress ]::Loopback
183
183
Log " Testing availability of port ${PortNumber} at address ${ipAddress} / $ ( $ipAddress.AddressFamily ) "
184
184
185
- $tcpListener = New-Object System.Net.Sockets.TcpListener @ ($ipAddress , $PortNumber )
185
+ $tcpListener = Microsoft.PowerShell. Utility\ New-Object System.Net.Sockets.TcpListener @ ($ipAddress , $PortNumber )
186
186
$tcpListener.Start ()
187
187
$tcpListener.Stop ()
188
188
}
@@ -202,7 +202,7 @@ function Test-PortAvailability {
202
202
}
203
203
204
204
$portsInUse = @ {}
205
- $rand = New-Object System.Random
205
+ $rand = Microsoft.PowerShell. Utility\ New-Object System.Random
206
206
function Get-AvailablePort () {
207
207
$triesRemaining = 10 ;
208
208
@@ -247,7 +247,7 @@ try {
247
247
LogSection " Start up PowerShellEditorServices"
248
248
Log " Importing PowerShellEditorServices"
249
249
250
- Import-Module PowerShellEditorServices - ErrorAction Stop
250
+ Microsoft.PowerShell. Core\ Import-Module PowerShellEditorServices - ErrorAction Stop
251
251
252
252
# Locate available port numbers for services
253
253
# There could be only one service on Stdio channel
0 commit comments