Don’t copy and paste the same code over and over again. Instead, create a PowerShell function and save yourself time.
The following would be a good place to start I reckon. One book should be good enough to start - I usually recommend Learn Windows PowerShell in a Month of Lunches (Ace mentioned this) for anyone new ...