Answer the question
In order to leave comments, you need to log in
How to finish ps script?
Good afternoon, I ask for help in finalizing the script, point out the error and make a correction.
In an ideal world, the script should run from the Domain Controller and deploy programs
Answer the question
In order to leave comments, you need to log in
I think the first thing you need to do is break your script down into smaller steps.
and perform each step separately, controlling its execution. That is, to execute not from a file, but independently from the console.
1. get a list of computers: $computers = ...
2. check that we got what we need: $computers.Count; $computers[0]
3. Run the first part of the installation on one of the computers: Invoke-Command -ComputerName $computers[0] { here is the chocolatey installation
command
} comp: Invoke-Command -ComputerName $computers[0] { choco install commands here }
6. make sure everything is up: get on the computer and see
7. clear the list of computers from those that are turned off: independent exercise
8. repeat steps 3 and 5 on the cleared list: independent exercise
As a result, from steps 1, 7 and 8 you can combine a working
script do not save line translations, it is impossible to read.
And do not abuse pipes until you understand what you get at each stage, write everything in variables
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question