The full error message you will get is:
[PS] C:\Windows\system32>New-DatabaseAvailabilityGroup -Name EXCHDAG01 -WitnessServer fileserver.int.contoso.com -FileSystem ReFS -WitnessDirectory C:\WitnessDirectory\EXCHDAG01
WARNING: Failed to create file share witness directory 'C:\WitnessDirectory\EXCHDAG01' on witness server
'fileserver.int.contoso.com'. Until this problem is corrected, the database availability group may be more vulnerable to
failures. You can use the Set-DatabaseAvailabilityGroup cmdlet to try the operation again. Error: WMI exception
occurred on server 'fileserver.int.contoso.com': The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
Name Member Servers Operational Servers
---- -------------- -------------------
This might be due to the following reasons:
- The high port range (1024-65535) from the exchange server towards the server which will host the witness directory is closed (e.g a hardware firewall or a OS firewall)
- The RPC service is stopped on the remote server.
- The Endpoint Mapper on port 135 couldn´t be reached on the remote server (often due to a hardware firewall or a OS firewall)
Note: You might try to run the following command: "rpcping /s <servername> /t ncacn_ip_tcp" where <servername> is the name of the remote server to check if RPC is working. However in some rare szenarios the high port range is blocked due to a firewall feature also if the command shows it is working!