Create a minimal Dockerfile with the following:
FROM microsoft/powershell:6.0.0-nanoserver-1709
SHELL ["pwsh"]
RUN Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v4.5.0/nuget.exe" -OutFile nuget.exe
The file downloads just fine and is available inside container.
The argument 'Invoke-WebRequest' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Note that when I run docker run -it microsoft/powershell:6.0.0-nanoserver-1709 and then execute the Invoke-WebRequest, all is fine.
FROM microsoft/powershell:6.0.0-nanoserver-1709
SHELL ["pwsh", "-Command"]
RUN Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v4.5.0/nuget.exe" -OutFile nuget.exe
@bloodybeet pwsh uses -File flag by default. You need to specify -Command if you want to run a script string directly.
Note that this was actually a change from Windows PowerShell. Using Windows PowerShell (Desktop Edition), you can simply specify a command after the executable name. However, this was changed in PowerShell Core to act more like Bash, as I understand it.

Verified that the docker build is successful with the change suggested by @pcgeek86
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM microsoft/powershell:6.0.0-nanoserver-1709
6.0.0-nanoserver-1709: Pulling from microsoft/powershell
407ada6e90de: Already exists
711a33cda32c: Pull complete
5f5589a467e5: Pull complete
d50558d94b1e: Pull complete
376b8d293962: Pull complete
b4c4521a1951: Pull complete
6a9fca0fbefe: Pull complete
7bf29c6a0e4f: Pull complete
3bef1c441b8f: Pull complete
83220a6ead00: Pull complete
ab070f6e164f: Pull complete
Digest: sha256:b5359ee98bcbc7c88da4eaa297265a3b27c9c9deb762e270241c8214524849ea
Status: Downloaded newer image for microsoft/powershell:6.0.0-nanoserver-1709
---> 29a006b326ce
Step 2/3 : SHELL pwsh -Command
---> Running in 2d250e6be3a3
---> fa26c756533a
Removing intermediate container 2d250e6be3a3
Step 3/3 : RUN Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v4.5.0/nuget.exe" -OutFile nuget.exe
---> Running in 926cb4362fc2
---> cf3d2ccfa996
Removing intermediate container 926cb4362fc2
Successfully built cf3d2ccfa996
Hence, I will close this issue.
Thanks guys :) !
Most helpful comment
Verified that the docker build is successful with the change suggested by @pcgeek86
Hence, I will close this issue.