May 4, 2004 #1 WildWest Programmer Apr 2, 2002 111 US Does anyone have any sample code that will remove a user from a local group on NT 4? Thanks in advance!
Does anyone have any sample code that will remove a user from a local group on NT 4? Thanks in advance!
May 6, 2004 1 #2 percent IS-IT--Management Apr 27, 2004 176 US 'I couldn't find the API but if you don't mind you could do something like this Private Sub Form_Load() MsgBox RemoveUser("Bill","C:\UsrLog.txt"), vbInformation, "User Removal Status" End Sub Private Function RemoveUser(Username as string,LogFile as String)As String dim tmp as string if not LogFile="" then kill LogFile shell "cmd /c net user " & Username & " /Delete >> " & Logfile Open FileName For Input As #1 Line Input #1, tmp RemoveUser=tmp else msgbox "Invailid Logfile - Operation Cancelled", vbInformation, "User Removal Status" endif End Function Upvote 0 Downvote
'I couldn't find the API but if you don't mind you could do something like this Private Sub Form_Load() MsgBox RemoveUser("Bill","C:\UsrLog.txt"), vbInformation, "User Removal Status" End Sub Private Function RemoveUser(Username as string,LogFile as String)As String dim tmp as string if not LogFile="" then kill LogFile shell "cmd /c net user " & Username & " /Delete >> " & Logfile Open FileName For Input As #1 Line Input #1, tmp RemoveUser=tmp else msgbox "Invailid Logfile - Operation Cancelled", vbInformation, "User Removal Status" endif End Function
May 8, 2004 #3 percent IS-IT--Management Apr 27, 2004 176 US Actually this should work better 'I couldn't find the API but if you don't mind you could do something like this Private Sub Form_Load() MsgBox RemoveUser("Bill","C:\UsrLog.txt"), vbInformation, "User Removal Status" End Sub Private Function RemoveUser(Username as string,LogFile as String)As String dim tmp as string,tmp2 as string,i as long if not LogFile="" then kill LogFile shell "cmd /c net user " & Username & " /Delete >> " & Logfile Open FileName For Input As #1 for i = 0 to 3 Line Input #1, tmp tmp2=tmp2 & tmp next RemoveUser=tmp else msgbox "Invailid Logfile - Operation Cancelled", vbInformation, "User Removal Status" endif End Function Upvote 0 Downvote
Actually this should work better 'I couldn't find the API but if you don't mind you could do something like this Private Sub Form_Load() MsgBox RemoveUser("Bill","C:\UsrLog.txt"), vbInformation, "User Removal Status" End Sub Private Function RemoveUser(Username as string,LogFile as String)As String dim tmp as string,tmp2 as string,i as long if not LogFile="" then kill LogFile shell "cmd /c net user " & Username & " /Delete >> " & Logfile Open FileName For Input As #1 for i = 0 to 3 Line Input #1, tmp tmp2=tmp2 & tmp next RemoveUser=tmp else msgbox "Invailid Logfile - Operation Cancelled", vbInformation, "User Removal Status" endif End Function