Files
Backup/_NDGOV_WindowsTeam/ITD.Infra-VMware.Administration/Public/Remove-ITDVMwareCdDriveMedia.ps1
T
Zack Meier 1d304511b8 update
2026-04-15 15:45:50 -05:00

49 lines
1.3 KiB
PowerShell

<#
.SYNOPSIS
A short one-line action-based description, e.g. 'Tests if a function is valid'
.DESCRIPTION
A longer description of the function, its purpose, common use cases, etc.
.NOTES
Information or caveats about the function e.g. 'This function is not supported in Linux'
.LINK
Specify a URI to a help page, this will show when Get-Help -Online is used.
.EXAMPLE
Test-MyTestFunction -Verbose
Explanation of the function or its result. You can include multiple examples with additional .EXAMPLE lines
#>
function Remove-ITDVMwareCdDriveMedia {
[CmdletBinding()]
Param
(
[string[]]
$ComputerName,
[PSCredential]
$Credential
)
Begin {
Connect-ITDvCenter -Credential $Credential
Write-Verbose "Connected to: $global:DefaultVIServers"
If ($global:DefaultVIServers.Count -gt 0) {
Write-Verbose "connected to VI server(s)"
}
Else {
Write-Warning "not connected to any VIservers, stopping script"
break
break
}
}
Process {
ForEach ($c in $ComputerName) {
$CurrentVM = $null
$CurrentVM = Get-VM -Name $c
$CurrentVM | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
}
}
End {
}
}