locked
Selective install RRS feed

All replies

  • Please format a post you script correctly.  Use the code posting tool provided.


    \_(ツ)_/

    Monday, April 2, 2018 7:28 PM
  • On the edit bar "<>" is the icon.


    \_(ツ)_/

    Monday, April 2, 2018 7:33 PM
  • You have no reference to $computer in your script, so basically ure just testing connection to multiple computers and nothing else (rest of the code is irrelevant at this point).

    Try implement invoke-command -computername $computer   -scriptblock {} 

    Then, i guess, u will run into double-hop issue ...

    Monday, April 2, 2018 7:45 PM
  • I'm sorry, I do not see that in the edit or on my toolbar across the top of the powershell console.

    The edit bar on this forum where you create and format entries.

    Edit your original post.  Just click "edit" and the editor will be displayed and you will see the toolbar.


    \_(ツ)_/

    Monday, April 2, 2018 7:53 PM
  • Monday, April 2, 2018 7:54 PM
  • I really can't understand how computer people are so lame when they try to use forums.  First look and understand the forum then post following the forum standards. 

    It is amazing how so many people do not understand how tooltips can appear over most icons when hovered.  This has been part of all systems form almost 30 years.


    \_(ツ)_/

    Monday, April 2, 2018 7:58 PM
  •  # Get list of computers to install to     $computers = Get-Content "\\10.XXX.XXX.XXX\netmotion\mdtv5\MDTForce.csv"     ForEach ($computer in $computers){         If(Test-Connection -ComputerName $computer -Quiet -Count 1){      # Check to see if V4 is installed, if so close program and remove directory & shortcut     if (test-path "C:\writefor\mdc") { #### You checking this on YOUR computer, not remote one        ...

    }

    Monday, April 2, 2018 7:59 PM
  • Got it.  I thought you were referring to the console. 

    Updated.

    Still is not indented properly.  All block levels need to be indented including embedded blocks. Without this the code is hard to understand and hard to debug.  It prevents you from seeing your mistakes.


    \_(ツ)_/

    Monday, April 2, 2018 7:59 PM
  •  # Get list of computers to install to     $computers = Get-Content "\\10.XXX.XXX.XXX\netmotion\mdtv5\MDTForce.csv"     ForEach ($computer in $computers){         If(Test-Connection -ComputerName $computer -Quiet -Count 1){      # Check to see if V4 is installed, if so close program and remove directory & shortcut     if (test-path "C:\writefor\mdc") { #### You checking this on YOUR computer, not remote one        ...

    }

    If the code was properly formatted this would become quite obvious as well as the rest of the errors.


    \_(ツ)_/

    Monday, April 2, 2018 8:00 PM
  • There are more than a dozen errors including many broken lines because the code was copied incorrectly from somewhere.


    \_(ツ)_/

    Monday, April 2, 2018 8:03 PM
  • I did not fix your code but this is what it looks like when indented properly:

     # Get list of computers to install to
    $computers = Get-Content "\\10.XXX.XXX.XXX\netmotion\mdtv5\MDTForce.csv"
    ForEach ($computer in $computers){
        If(Test-Connection -ComputerName $computer -Quiet -Count 1){
    
            # Check to see if V4 is installed, if so close program and remove directory & shortcut
            if (test-path "C:\writefor\mdc") {
                (start-process "taskkill" -argumentlist "/IM mdc.exe" -wait)
                rmdir c:\writefor\mdc -recurse
                \\10.XXX.XXX.XXX\netmotion\psexec.exe -accepteula -u UUUUUUUU -p PPPPPPPP cmd /min /c start /min cmd /c del "C:\users\public\desktop\mdt force.lnk"
            }
    
            # Check to see if 64 bit OS, install appropriate version if not already installed
            if (-not (test-path "C:\program files\application data systems, inc\MDT force")){
                if (test-path "c:\program files (x86)") {
                    \\10.XXX.XXX.XXX\netmotion\psexec.exe -accepteula -u UUUUUUUU -p PPPPPPPP cmd /min /c (start-process "msiexec.exe" -argumentlist "/qr /i \\10.XXX.XXX.XXX\netmotion\MDTV5\MDTForceinstall64-v5.0.9.msi"
                -wait)
                    (start-process \\10.XXX.XXX.XXX\netmotion\mdtv5\mdtforce64.reg -wait)
                } else {
                    \\10.XXX.XXX.XXX\netmotion\psexec.exe -accepteula -u UUUUUUUU -p PPPPPPPP cmd /min /c (start-process "msiexec.exe" -argumentlist "/qr /i \\10.XXX.XXX.XXX\netmotion\MDTV5\MDTForceinstall32-v5.0.9.msi"
                -wait)
                    (start-process \\10.XXX.XXX.XXX\netmotion\mdtv5\mdtforce32.reg -wait)
                }
            }
               
               
            # Check to see if 64 bit updater is installed, install appropriate version if not already installed.
            if (-not (test-path "C:\program files\Application Data Systems, Inc\ADSI Updater\")){    
                if (test-path "c:\program files (x86)") {
                    \\10.XXX.XXX.XXX\netmotion\psexec.exe -accepteula -u UUUUUUUU -p PPPPPPPP cmd /min /c start /min cmd /c msiexec.exe /qr /i \\10.XXX.XXX.XXX\netmotion\MDTV5\updaterinstall64-v1.0.0.msi
                } else {
                    \\10.XXX.XXX.XXX\netmotion\psexec.exe -accepteula -u UUUUUUUU -p PPPPPPPP cmd /min /c start /min cmd /c msiexec.exe /qr /i \\10.XXX.XXX.XXX\netmotion\MDTV5\updaterinstall32-v1.0.0.msi
                }
            }
        }
    }
    


    \_(ツ)_/

    Monday, April 2, 2018 8:05 PM
  • You are misusing parens and the code is inconsistent in use of commands.  None of the commands addresses anything but the local system as ahs been noted.


    \_(ツ)_/

    Monday, April 2, 2018 8:06 PM
  • You cannot run PowerShell commands using "cmd /min/c"


    \_(ツ)_/

    Monday, April 2, 2018 8:08 PM
  • You just need to test if the machine is in the list.

    if($env:COMPUTERNAME -in $csvlist){
         # rest of code
    }

    This is what happens when you blindly copy code from the Internet.  You need to learn enough PowerShell to be able to understand the scripts uyou are trying to use.


    \_(ツ)_/

    Monday, April 2, 2018 9:33 PM
  • Well thank you.  I did not blindly copy anything from the internet.  I did look at examples there and tried to build from what I was trying to learn from there.  I respectfully withdraw and wish to delete everything here as I did not come here to be insulted, but to try to learn something and to understand what I was doing wrong, but I guess this is not the proper place for that.

    Thank you.

    Please delete everything in this thread!

    Monday, April 2, 2018 9:40 PM
  • I am not trying to insult you. You clearly did not understand what you copied.  The code you copied is intended to execute on all computers in the CSV.  You are telling us you want it to only execute "IF" the current computer is in the CSV.  This is not clear or specified in your original post.

    If you understood the code you copied you would understand that there is no point in testing every computer or in testing the local computer with Test-Connection.  If you are executing the script then, of course, the local computer is running.

    Without good basic understanding of PowerShell and its commands you will have a very hard time with it.  I am only warning you that not understanding the code is a good way to get into a corner and to waste a lot of time.   It will also be difficult dfor you to ask a clear question as you can now see.

    Take the time to learn PowerShell and this won't happen.

    Here is an excellent place to start: Learn PowerShell  


    \_(ツ)_/


    • Edited by jrv Monday, April 2, 2018 9:47 PM
    Monday, April 2, 2018 9:47 PM
  • Throwing a tantrum is no way to become a tech.

    Why would you get angry at someone who has many more years of experience than you when they suggest that you do not know enough and probably know bad information. 

    I posted the solution to your issue.  You didn't even look at it.


    \_(ツ)_/


    • Edited by jrv Monday, April 2, 2018 9:51 PM
    Monday, April 2, 2018 9:50 PM
  • I had an immediate need to make this deployment, I do have a book on Powershell and am making every effort to learn what I can of it.  I did not have the time to learn as much as I would have liked to before having to try to create this deployment.  I do understand that and admit that I am very green with Powershell, but sometimes you have to do what you have to do to make things happen.

    Actually I explained in the original post, although before and after the code that was in the incorrect format, each step of what I was trying to accomplish.  I removed it when I reformatted the code as requested.

    Thanks for your time and I am sorry to have wasted it for you.  Please delete all in this thread as I do not intend to return and other than the fact that I am very Green at best with Powershell and that I have wasted your time I see no relevance for anyone else.

    Thanks.

    Monday, April 2, 2018 9:54 PM
  • I am not throwing a tantrum.  You said "This is what happens when you blindly copy code from the Internet.  You need to learn enough PowerShell to be able to understand the scripts uyou are trying to use." I did not "blindly" copy code.  I did look at your solution, and I do respect your years of experience, I came here for someone to guide me with their years of experience and not to belittle me for my lack of knowledge. 

    Also "I really can't understand how computer people are so lame when they try to use forums.  First look and understand the forum then post following the forum standards. 

    It is amazing how so many people do not understand how tooltips can appear over most icons when hovered.  This has been part of all systems form almost 30 years."

    Seems belittling to me.....


    And thank you for the information you did give me.


    • Edited by DPS DLoper Monday, April 2, 2018 10:03 PM
    Monday, April 2, 2018 9:59 PM
  • I had an immediate need to make this deployment, I do have a book on Powershell and am making every effort to learn what I can of it.  I did not have the time to learn as much as I would have liked to before having to try to create this deployment.  I do understand that and admit that I am very green with Powershell, but sometimes you have to do what you have to do to make things happen.

    Actually I explained in the original post, although before and after the code that was in the incorrect format, each step of what I was trying to accomplish.  I removed it when I reformatted the code as requested.

    Thanks for your time and I am sorry to have wasted it for you.  Please delete all in this thread as I do not intend to return and other than the fact that I am very Green at best with Powershell and that I have wasted your time I see no relevance for anyone else.

    Thanks.

    There is no need to delete anything.  The biggest issue is that we could not understand what you were asking until you, much later, explained the purpose.  I posted the answer above and that is all upi need t do.  Remove the loop and test the computer with an "if".  Remove all other conenctions tests and just perform the operation you need.

    Once you can be clear most issues can be easily solved.  We cannot guess at and rewrite code for you especially when you are not clear and accurate about what you are trying to do.

    We cannot be responsible for your work requirements.  We can answer specific questions.  The question and the application are your responsibility.

    If you really need help for a critical issue then you would do better to hire a consultant until you get up to speed with the systems and technology your job requires.

    Good luck.  Next time think a bit more about your issue and try to ask a simple question first.


    \_(ツ)_/

    Monday, April 2, 2018 10:06 PM
  • I am not throwing a tantrum.  You said "This is what happens when you blindly copy code from the Internet.  You need to learn enough PowerShell to be able to understand the scripts uyou are trying to use." I did not "blindly" copy code.  I did look at your solution, and I do respect your years of experience, I came here for someone to guide me with their years of experience and not to belittle me for my lack of knowledge. 

    Also "I really can't understand how computer people are so lame when they try to use forums.  First look and understand the forum then post following the forum standards. 

    It is amazing how so many people do not understand how tooltips can appear over most icons when hovered.  This has been part of all systems form almost 30 years."

    Seems belittling to me.....


    And thank you for the information you did give me.



    My statement was guidance.  It is not insulting.  It is a warning that copying scripts that you do not completely understand can be bad and may be dangerous. You must take the time to review and understand the scripts you are trying to use.

    \_(ツ)_/

    Monday, April 2, 2018 10:09 PM