Hello,
I have a script that is executing a ConfigMgr cmdlet:
New-CMDeviceCollection -Name $CNAME -LimitingCollectionName "All Systems" -RefreshType Both
When executed, if a collection already exists with the provided name it outputs the following warning message:
WARNING: The collection cannot be created because a collection with the specified name already exists. Create a collection with a different name.
I would like to capture this message and redirect its output to the screen in the following format:
WARNING: $CNAME cannot be created because a collection with the specified name already exists.
I have read about using 3>&1 but I'm having trouble finding a similar example to follow. Any help is greatly appreciated!
- Edited by LearnNewThings 15 hours 59 minutes ago