I had similar problem, but servers where I needed to run my scripts had no access to internet. I found a simple .exe program, that can run queries in similar way.
https://github.com/SqlQuantumLeap/SimpleSqlExec
You just call this exe instead a Invoke-sqlcmd.
.\SimpleSqlExec -cs $ConnectionStringDB -Q $query
Hope it helps.