none
如何通过VB.net自己实现“net user Administrator /active:yes”? RRS feed

  • 问题

  • 如何通过VB.net自己实现“net user Administrator /active:yes”?也就是通过vb.net的代码实现,而不是通过shell调用。

    谢谢


    编程是永无止境的,向大家学习

    2015年2月26日 3:35

答案

  • 你好

    如果你想要校验系统中账号是否激活,你可以用这个代码。同样你也可以通过这个代码获取Account的状态。

    Dim ComputerName As String = My.Computer.Name
            Dim User As New System.DirectoryServices.DirectoryEntry("WinNT://" & ComputerName & "/Administrator, user")
    
            If User.NativeObject.AccountDisabled Then
                Console.WriteLine("Account is disabled")
            Else
                Console.WriteLine("Account is active")
            End If


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2015年2月27日 6:36
    版主