Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Trying to run a file on a local computer

$
0
0

Hello guys, I am starting to lean a little scripting and have been successful in the past with .vbs stuff, but I'm trying to do this in powershell and really, I haven't taken any classes yet just trying to lean myself. However I have a project due soon and I need some help, hoping I can do this with powershell instead of manually installing.

I need IE11 on a list of computers. I have downloaded and created a silent install of IE11 with the MS AIK for IE11, so I have a 75MB .msi and or .exe I can use.

I found a script to use a list of computers to copy the files to because I only want this on certain computers:

 

$computers = gc "C:\scripts\computers.txt"

$source = "c:\test"

$dest = "c$"

foreach ($computer in $computers) {
        if (test-Connection -Cn $computer -quiet) {
        Copy-Item $source -Destination \\$computer\$dest -Recurse
            } else
{
        "$computer is not online"
        }
}

 

This works, the files are copied down with no issues. Now I want to run the files I just copied and I really don't know how to go about doing this. Am I even going in the right direction trying to copy it down first? Should I just run it from a network location?

Anyway I have admin credentials over all these computers, just FYI.

I was going to copy over a batch file to run the .msi or .exe but should I just try to run it directly? I really need help with this step, it can be in the same script or a different one, it doesn't matter. I guess it makes sense to only try to do this from the same list of computers I copied the files to. Any ideas I can try? I created a dummy .bat file to test with.

Thanks for any help you can give me.


Viewing all articles
Browse latest Browse all 6937

Trending Articles