need a script to run form my workstation a script form the file server

I want to copy the application installation file or a vbs script on a share created on a file server.

on my workstation I want to have a text file with computer names in txt or csv format.

want to use a tool like psexec that executes a command on the remote computer

run the application or the vbs file on all the computers listed in the text file.

clients are windows 7 sp1

appreciate help
Aamer MAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexProject Systems EngineerCommented:
You're going to need to give us more information, saying you want a script doesn't tell us what you want it to do.
Aamer MAuthor Commented:
on my workstation I will have a list of computer names in a text file or csv file on which I want to install some windows updates and IE11.

i want to store all the update files and the IE files on a file share: \\FS1\Share1\abc.vbs

i want from my computer to use a tool like psexec thal will take names from the text file and remotely run the vbs script to install the updates and ie on the client computers.

I run the psexec command from my workstation that should pick names from the text file and run the command to run the script on the client computers
AlexProject Systems EngineerCommented:
Seems a bit like a pain.


$Computers = Get-Content "Enter conputers here"
ForEach ($Computer in $Computers) {
	If (Test-Connection -ComputerName $Computer -Quiet) {
		& PSEXEC "\\$($Computer)" Enter psexec command
	} Else {
		"$($Computer) is not online" | Out-File -Append "C:\temp\compsnotline.txt"
	}
}

Open in new window

Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Aamer MAuthor Commented:
is there a better way for this.

there are 500 computers on which I want to remotely run a script stored on a file server. any suggestion will be very helpfull
AlexProject Systems EngineerCommented:
$Computers = Get-Content "c:\temp\listofcomputers.txt"
ForEach ($Computer in $Computers) {
	If (Test-Connection -ComputerName $Computer -Quiet) {
		& PSEXEC "\\$($Computer)" Enter psexec command
	} Else {
		"$($Computer) is not online" | Out-File -Append "C:\temp\compsnotline.txt"
	}
}

Open in new window


That's where you enter your Text file.
Aamer MAuthor Commented:
the command I want to run is

\\filesrv1\shared\script\script1.vbs or

\\filesrv1\shared\script\script1.bat

the psexec syntax is like this

psexec @computers.txt /accepteula -u "Domain\User" -p "password" -i 2 -d cmd.exe /c

this has to run using an elevated user.

I am really bad with scripts and help appreciated
kevinhsiehCommented:
If you have 500 machines, you should have WSUS in your environment at the very least, or maybe System Center Configuration Manager. You can manage all Microsoft updates via WSUS.
Aamer MAuthor Commented:
is an secure network and internet connectivity is not allowed. we download updates offline. put it in a share. make a script file to run the apps.

I know this is a very tiring process. but have no option
AlexProject Systems EngineerCommented:
$Computers = Get-Content "c:\temp\listofcomputers.txt"
ForEach ($Computer in $Computers) {
	If (Test-Connection -ComputerName $Computer -Quiet) {
		& PSEXEC.exe "\\$($Computer)" /accepteula -u "Domain\User" -p "password" -i 2 -d \\filesrv1\shared\script\script1.bat
	} Else {
		"$($Computer) is not online" | Out-File -Append "C:\temp\compsnotline.txt"
	}
}

Open in new window


That should do it.
kevinhsiehCommented:
Since you obviously have an internal connection to your devices, you can still use WSUS for updates. WSUS doesn't need connection to the Internet.
http://www.wsusoffline.net/
Aamer MAuthor Commented:
I fought for it but its not allowed. now the only option I have is to run it form a file server
Aamer MAuthor Commented:
Alex

the script does nothing

$Computers = Get-Content "c:\temp\listofcomputers.txt"
ForEach ($Computer in $Computers) {
      If (Test-Connection -ComputerName $Computer -Quiet) {
            & PSEXEC.exe "\\$($Computer)" /accepteula -u "abc\administrator" -p "Password1" -i 2 -d \\\\192.168.1.100\IE32\IE11-Setup-Full.msi
      } Else {
            "$($Computer) is not online" | Out-File -Append "C:\temp\compsnotline.txt"
      }
}
Shaun VermaakTechnical SpecialistCommented:
No need to use Powershell to loop command for multiple computers, it support lists.

Secondly, psexec can copy the file using -c so no need to use UNC paths either.

Lastly, psexec 2.1 encrypts credentials over the wire so -p -u does not transmit clear-text

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aamer MAuthor Commented:
could you kindly give me the complete command

a file server on which I will either have a .msi for a .vbs for example \\fileserver1\share\ie11.msi or vbs

on the admin workstation I will install pstools and create a text file on c:\temp\computerlist.txt

firstly I want to run run this using an admin account.

I want to copy the package locally on the client and then run the .msi or vbs

appreciate a quick response as I have to test it in the lab before I implement this
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.