The below should be added to prevent error [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12