Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

setinfo() -> The specified directory service attribute or value does not exist.

$
0
0

I would like to determine the wrong ATTRIBUTE NAME from the exception object (I would like to log the error...)

try {
$Searcher = New-Object -TypeName System.DirectoryServices.DirectorySearcher
...
$result = $Searcher.FindOne().GetDirectoryEntry()
$result.putex( 2, 'Title' , 'New title' )
$result.putex( 1, 'Deeeeeeeescription' , $null ) # I misspelled it... to get an error...

$result.setinfo()
} catch {
$err = $_
}
# I can get the error message...
$err.Exception.InnerException     # Error: The specified directory service attribute or value does not exist.

# Hot to find out which attribute? (in this case I should find: 'Deeeeeeeescription' )



Viewing all articles
Browse latest Browse all 21975

Trending Articles