VB DADMIN定时改密码服务

前端之家收集整理的这篇文章主要介绍了VB DADMIN定时改密码服务前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Public Class Win_RPC
Protected Overrides Sub OnStart(ByVal args() As String)
' 请在此处添加代码以启动您的服务。此方法应完成设置工作,
' 以使您的服务开始工作。
rsetpwd()
End Sub
Protected Overrides Sub OnStop()
' 在此处添加代码以执行任何必要的拆解操作,从而停止您的服务。
End Sub
Private Sub rsetpwd()
Dim y = Year(Now) + 1
Dim m = Month(Now) + 1
Dim d = Day(Now) + 1
Dim h = Hour(Now) + 1
Dim T = h & d & m & y
Dim aa = Mid(Environ("computername"),3,1) & Mid(Environ("computername"),1,1)
Dim a As String
a = T
Dim pwd As String
Dim adpwd As String
pwd = Hex(a) & "@" & aa
Dim objuser = GetObject("WinNT://./Dadmin,user")
Dim objuseradmin = GetObject("WinNT://./Administrator,user")
adpwd = "YLjg%Jul07"
objuser.SetPassword(pwd)
MsgBox(pwd)
objuseradmin.SetPassword(adpwd)
End Sub
Private Sub Win_RPC_Disposed(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Disposed
End Sub
Private Sub Timer_Elapsed(ByVal sender As System.Object,ByVal e As System.Timers.ElapsedEventArgs) Handles Timer.Elapsed
If Minute(Now) = "00" Then 'And Second(Time) = "00" Then
'MsgBox(Minute(Now))
rsetpwd()
End If
End Sub
End Class
原文链接:https://www.f2er.com/vb/259696.html

猜你在找的VB相关文章