我想从服务器 WSKELLER 中删除所有 DHCP 租约和保留。从文档中我似乎明白这将通过以下方式完成:
Get-DhcpServerv4Scope -ComputerName WSKELLER | Remove-DhcpServerv4Lease -ComputerName WSKELLER
cmdlet 确实找到了所有租约,但它为每个租约抛出以下错误:
Remove-DhcpServerv4Lease : Failed to delete lease 10.10.12.32 from scope 10.10.0.0 on DHCP server WSKELLER.
At C:\admin\removeDhcpDns.ps1:8 char:48
+ ... mputerName WSKELLER | Remove-DhcpServerv4Lease -ComputerName WSKELLER +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (10.10.12.32:root/Microsoft/...cpServerv4Lease) [Remove-DhcpServerv4Lease], CimException
+ FullyQualifiedErrorId : DHCP 20019,Remove-DhcpServerv4Lease
显然我做错了。但是哪一个?
从你的错误:
+ FullyQualifiedErrorId : DHCP 20019,Remove-DhcpServerv4Lease
来自:https ://msdn.microsoft.com/en-us/library/windows/desktop/aa363378(v=vs.85).aspx
您似乎正在尝试删除预订。如果这是故意的,那么您将需要改用
Remove-DhcpServerv4Reservation
cmdlet。