Unable to pull images from docker hub

I’m trying to automate things. I have a PowerShell script which will launch the Amazon instance and install docker.i’m able to login to Docker login but unable to pull images. When I do it from Windows PowerShell command line it works just fine but when I do it inside the script it just won’t work. Please find the script below.

"$ Docker Login"
$DOCKER_USER="xxxx"
$DOCKER_PASS="xxxx"
docker login --username=$DOCKER_USER --password=$DOCKER_PASS

Os: windows server 2016
docker version:

PS C:\> docker version
Client:
 Version:      17.03.1-ee-3
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   3fcee33
 Built:        Thu Mar 30 19:31:22 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.03.1-ee-3
 API version:  1.27 (minimum version 1.24)
 Go version:   go1.7.5
 Git commit:   3fcee33
 Built:        Thu Mar 30 19:31:22 2017
 OS/Arch:      windows/amd64
 Experimental: false

docker pull won’t work and it just hangs like this:

PS C:\Users\Administrator\Desktop> docker pull 474614/my_repo:javaprogram
javaprogram: Pulling from 474614/my_repo
3889bb8d808b: Pulling fs layer
423d66441981: Pulling fs layer
31d767f25d17: Pulling fs layer
b97cf9d73d51: Pulling fs layer
03004a043191: Pulling fs layer
19506dd59345: Pulling fs layer
5126364976fd: Pulling fs layer
62d7464c27c0: Pulling fs layer
e332822eeca9: Pulling fs layer
7b86ee31be04: Pulling fs layer
d0e690ab14f8: Pulling fs layer
1fc46d77d062: Pulling fs layer
b7a18b2502fb: Pulling fs layer
ae19e0bac7c9: Pulling fs layer
b97cf9d73d51: Waiting
03004a043191: Waiting
19506dd59345: Waiting
5126364976fd: Waiting
62d7464c27c0: Waiting
e332822eeca9: Waiting
7b86ee31be04: Waiting
d0e690ab14f8: Waiting
1fc46d77d062: Waiting
b7a18b2502fb: Waiting
ae19e0bac7c9: Waiting
31d767f25d17: Verifying Checksum
31d767f25d17: Download complete
b97cf9d73d51: Verifying Checksum
b97cf9d73d51: Download complete
03004a043191: Verifying Checksum
03004a043191: Download complete
19506dd59345: Verifying Checksum
19506dd59345: Download complete
5126364976fd: Verifying Checksum
5126364976fd: Download complete
62d7464c27c0: Verifying Checksum
62d7464c27c0: Download complete
e332822eeca9: Verifying Checksum
e332822eeca9: Download complete
7b86ee31be04: Verifying Checksum
7b86ee31be04: Download complete
d0e690ab14f8: Verifying Checksum
d0e690ab14f8: Download complete
1fc46d77d062: Verifying Checksum
1fc46d77d062: Download complete
b7a18b2502fb: Verifying Checksum
b7a18b2502fb: Download complete
ae19e0bac7c9: Verifying Checksum
ae19e0bac7c9: Download complete
423d66441981: Verifying Checksum
423d66441981: Download complete

even i tried to pull the image using the below script but still no go

$account    = "474614"
$reponame   = "my_repo"


$latest     = $account + "/" + $reponame + ":javaprogram"

docker pull $latest

Kindly help me with the PowerShell script which will pull the image from docker hub on a windows machine. Any advice on this would be helpful. Thanks in advance