François-Xavier Cat
François-Xavier Cat
@evetsleep That would be nice, Will check on my side too :-) btw are you on twitter or something ?
@evetsleep Nice, added you. This article summarize well the approach I took, the 'new way'. http://ianatkinson.net/computing/adcsharp.htm I looked at adding PropertiesToLoad but it seems only available with DirectorySearcher. Not sure...
@evetsleep What about using... PrincipalSearcher ? We can access the DirectorySearcher Looks pretty fast ``` powershell function Test-PrincipalSearcher { # Principal Context $PrincipalContext = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList $([System.DirectoryServices.AccountManagement.ContextType]::Domain),$([System.DirectoryServices.ActiveDirectory.Domain]::Getcurrentdomain()) #...
@evetsleep Actually, I was not talking to the DirectorySearcher directly, here is a corrected version ``` powershell function Test-PrincipalSearcher { # Principal Context $PrincipalContext = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList $([System.DirectoryServices.AccountManagement.ContextType]::Domain),...
Related: https://evetsleep.github.io/adsi/2017/02/22/SDSFormat.html
Thanks @Stephanevg ! We do have some basic unit tests here: https://github.com/lazywinadmin/AdsiPS/tree/master/Tests Feel free to improve them
I asked the question on the #testing channel on Slack @chrisdent: > for unit testing ADSI, I tend to write quite extensive mocked objects. Got an example somewhere... > https://floobits.com/PoshCode/PowerShell.Slack.com/file/chrisdent/ADAuthorizedDhcpServer.tests.ps1:235...
Thanks @MickyBalladelli ! Yeah I guess I could take this approach I was just hoping i could rely on .net
Hum you right @christophekumor Maybe we should validate all functions (where possible) support that.
Thanks @gwojan ! Looks promising indeed. Will give it a shot probably in January.