Method to Duplicate String Multiple Times While Substituting Specific Variables For Each
Posted on 2014-02-03
Good Afternoon All -
I have a PowerShell string that I use with SCCM 2012 to advertise monthly updates. The string (below) is a single line, but fairly long.
Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "Workstation Related - Feb 2014 Deployment" -CollectionName "Workstation Patch Management - Window #8 - 3rd Wednesday - Auto Restart" -DeploymentName "Workstation Patch Management - Window #8 - 3rd Wednesday - Auto Restart Feb 2014" -DeploymentType Required -VerbosityLevel OnlySuccessAndErrorMessages -TimeBasedOn UTC -DeploymentAvailableDay 2014/2/19 -DeploymentAvailableTime 6:00 -DeploymentExpireDay 2014/2/19 -DeploymentExpireTime 6:00 -UserNotification DisplaySoftwareCenterOnly -SoftwareInstallation $False -AllowRestart $False -RestartServer $False -RestartWorkstation $False -ProtectedType NoInstall -UnprotectedType NoInstall
What I'm wanting to do is find a way to duplicate this string, but be when doing so change some variables for each - possibly from a list.
The collection name defined in the string above is "Workstation Patch Management - Window #8 - 3rd Wednesday - Auto Restart." I have a list of a couple hundred collections which I'd like to use this script for. How may I easily duplicate the string above in a text editor (or other) and replace just that part of the string on each line with a line from the list of collections? Doing so would result in making each command string similar, but still each have different collection names.
Per string, I would have to change the Collection Name, Deployment Name, Time, and Date.
Is there any way to do this in Excel or other app without causing more frustration than it's worth?