Author Posts

November 21, 2016 at 9:09 pm

I have an output file that has the following inside of it:
Product A
Product B
Product C

I can have powershell say: If (Product A) then execute this If (Product B) then execute this If (Product C) then execute this
But what is the best way to have it copy Products A-C from ServerA to Client A, then execute Product A, B, and C in order? When I say execute I mean install(Products A,B,C are programs)

Would a switch be the best path?

Switch ($products)
Product A {} 
Product B {} 
Product C {}

November 22, 2016 at 12:22 am

Are you still trying to re-invent the wheel? 😉 You really should have a look to the Microsoft Deployment Toolkit. It is made for scenarios like yours. And it will make your life easier.

To copy files oder folders you can use 'Copy-Item' or if it's more than just a few files you should use 'robocopy'.

November 22, 2016 at 2:51 am

I'm sorry but installing just the INF drivers isn't going to be the best route for my situation

November 22, 2016 at 7:07 am

Hi Justin, PowerShell can do a lot of things. Yes, a switch statement could solve your problem. But, to understand your challenge, please provide us some code that you already tried to provide you some assistance.

November 28, 2016 at 5:28 pm

$MB_NAME = Get-WmiObject win32_baseboard | select -ExpandProperty Product 

Switch ($MB_NAME) {

"P7xxDM2(-G)                     " {Copy-Item ".\folder" "C:\Users\Test\Desktop\Install" -Recurse -Verbose -Force; Break} 
"Placeholder" {Copy-Item ".\folder" "C:\Users\Test\Desktop\Install" -Recurse -Verbose -Force; Break} 
"Placeholder" {Copy-Item ".\folder" "C:\Users\Test\Desktop\Install" -Recurse -Verbose -Force; Break} 
"Placeholder" {Copy-Item ".\folder" "C:\Users\Test\Desktop\Install" -Recurse -Verbose -Force; Break} 
Default {"Motherboard not found"; break}

After it is finished copying over the files, what is the best way to tell the system to continue and install the ".\folder" powershell script?