Automation

 View Only
  • 1.  Rename tags to upper case

    Posted 10 days ago
    Edited by RHari 10 days ago

    Hi Guys,

    I am trying to rename all vSphere backup tags with lowercase CHR to upper case.

    Below query is listing all the tags 

    get-tag -Category BackupTag -PipelineVariable Tag | where {$_.Name -cmatch "[a-z]"}

    I am then trying to add set tag to it like this, but that doesn't work. Can anyone advise? 

    get-tag -Category BackupTag -PipelineVariable Tag | where {$_.Name -cmatch "[a-z]"} | Set-Tag -Name ($_.Name).ToUpper()



  • 2.  RE: Rename tags to upper case
    Best Answer

    Posted 9 days ago

    Try like this

    Get-Tag -Category BackupTag -PipelineVariable tag | 
    where {$_.Name -cmatch "[a-z]"} | 
    ForEach-Object -Process {
       Set-Tag -Tag $tag -Name $tag.Name.ToUpper()
    }


    ------------------------------


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


    ------------------------------



  • 3.  RE: Rename tags to upper case

    Posted 9 days ago

    Thanks Luke!!