Can powershell do this?

Welcome Forums General PowerShell Q&A Can powershell do this?

This topic contains 4 replies, has 3 voices, and was last updated by

2 years, 3 months ago.

  • Author
  • #58381

    Points: 0
    Rank: Member

    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 {}
  • #58391

    Points: 1,164
    Helping Hand
    Rank: Community Hero

    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'.

  • #58399

    Points: 0
    Rank: Member

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

  • #58403

    Points: 26
    Rank: Member

    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.

  • #58843

    Points: 0
    Rank: Member
    $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?

The topic ‘Can powershell do this?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort