Hello all,
I try to convert a result from request with powershell module Get-ADcomputer. I would like to generate new computer name by checking Computers name in AD and increment the number. My machines name are like : "desktop0001, desktop0002....
my script :
*******************************************************
# REQUEST FROM AD
$adcheck = Get-ADComputer -Filter 'Name -like "DESKTOP0*"' | select Name
# KEEP ONLY THE LAST AD RESULT
$LastVM = $adcheck | select -Last 1 Name
# CONVERT TO STRING
$newname = $LastVM.Name | Out-String
#SPLIT DESKTOP NAME TO KEEP NUMBER TO INCREMENT
$a = $newname.split('DESKTOP')
Write-Host $a
$INT = [int]$a -> give some error
***************************************************
i tried some other ways without any luck
please help ^^
thanks