Manage docker swarm via command line only

We are trying to update a docker swarm during our build process with updated images.

Everything works when we do it manually: click icon in context menu of docker, choose the organization, click “Swarms -> OurSwarm” and the command window opens and we can update the swarm (e.g. update images).

The problem we have: how can we do all these manual steps fully automated (with Powershell or command line)?

We tried it with running the command "docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_HOST dockercloud/client ororganization/ourswarm, but this command requires input from stdin and it fails to run when it runs on a build machine without a user signed in (it has problems with tty).

We are using Docker for Windows and there should be a way to execute the same steps which we do manually with the docker context menu to connect to a swarm via command line.