Overview
To confirm whether M-Files server (mfserver.exe) can connect to the M-Files cloud endpoint for license automation, you need to run the testing tool as the SYSTEM account, because M-Files Server runs as a service and under the SYSTEM account. Testing by running powershell or cmd directly with your current user may, therefore, have different behavior.
Solution
Make sure you have PowerShell 6.0.0 or later, at the time of writing the latest version is 7.5.x, you can download it from Microsoft: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows
NOTE: This is a system component, changes to it are the responsibility of the local administrator. Make sure that this will not cause issues in your system.
NOTE 2: Version 6.0.0 or later is necessary for this test because it has the -NoProxy parameter for Invoke-WebRequest which allows the test to skip the system proxy - M-Files Server does not use the system proxy either, which is why this may be important.
If you cannot do this, see the Alternative Solution below.
Step 1
Run PowerShell as System: /article/Opening-CMD-as-Local-System-Account
M-Files Server runs as the SYSTEM account, so testing with the same account may be important in specific network conditions (e.g., some users/applications are allowed or disallowed from accessing the network).
Step 2
Save the following script and execute it in the elevated PowerShell window.
You should see success messages like below.
If you see errors, investigate them with your local network administrator.
# SCRIPT START
#First, two helper function for a prettier output and for the actual network test
function Write-Endpoint-Info {
param (
$TheDnsName,
$StatusCode,
$ExpectedStatusCode,
$ExceptionData
)
if( $ExceptionData -ne $null -and $StatusCode -ne $ExpectedStatusCode )
{
Write-Output $ExceptionData
}
else
{
Write-Output "Connection seems OK for: $TheDnsName"
}
}
function Test-Network {
param (
$TheDnsName,
$ExpectedStatusCode
)
try
{
# It is important that we use the -NoProxy flag, because M-Files Server does not use it either
$Response = Invoke-WebRequest -Uri $TheDnsName -NoProxy
# This will only execute if the Invoke-WebRequest is successful.
$StatusCode = $Response.StatusCode
Write-Endpoint-Info $TheDnsName $StatusCode $ExpectedStatusCode
} catch {
# So we have to do almost the same in the catch
$StatusCode = $_.Exception.Response.StatusCode.value__
Write-Endpoint-Info $TheDnsName $StatusCode $ExpectedStatusCode $_.Exception
}
}
# Calling the test
$ManagementApiAddress = "https://mfmgmtapiprod.cloudvault.m-files.com"
Test-Network $ManagementApiAddress 403 # This should return 403, so we need to catch it
$LoginAddress = "https://login.m-files.com"
Test-Network $LoginAddress 200
# SCRIPT END
Alternative Solution
In some cases you may be unable to upgrade Powershell or execute it as SYSTEM.
You can then try the following test that steps on CMD and built-in features of Windows. Note, however, that this is a more limited test - it tests TCP connectivity but not that actual data can pass through, and will still use any system proxy, which may be different from what M-Files Server sees in practice.
Step 1
Run CMD as System: /article/Opening-CMD-as-Local-System-Account
You can also double check that you are running as SYSTEM by running
whoami
Step 2
Run a test command, for example curl with telnet protocol:
curl -vv telnet://mfmgmtapiprod.cloudvault.m-files.com:443
curl -vv telnet://login.m-files.com:443
Example: Successful Network Test
If the network connectivity is open, you should receive a telnet session. You can press Ctrl+C to end it.
Microsoft Windows [Version 10.0.20348.1006]
(c) Microsoft Corporation. All rights reserved.
C:\Windows\system32>whoami
nt authority\system
C:\Windows\system32>curl -vv telnet://mfmgmtapiprod.cloudvault.m-files.com:443
* Trying 13.107.246.53:443...
* Connected to mfmgmtapiprod.cloudvault.m-files.com (13.107.246.53) port 443 (#0)
C:\Windows\system32>
Example: Failed Network Test
If you do not receive a session, there is likely a local network issue (such as a firewall, antivirus, forward proxy) blocking the traffic.
In such a case, review this with your network administrators.
Microsoft Windows [Version 10.0.20348.1006]
(c) Microsoft Corporation. All rights reserved.
C:\Windows\system32>whoami
nt authority\system
C:\Windows\system32>curl -vv telnet://mfmgmtapiprod.cloudvault.m-files.com:443
* Trying 13.107.246.53:443...
* connect to 13.107.246.53 port 443 failed: Bad access
* Failed to connect to mfmgmtapiprod.cloudvault.m-files.com port 443 after 60 ms: Bad access
* Closing connection 0
curl: (7) Failed to connect to mfmgmtapiprod.cloudvault.m-files.com port 443 after 60 ms: Bad access
C:\Windows\system32>
Other issues
See this article for more details and troubleshooting steps: License Automation On-Premises - FAQ.
