Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to remove someone from a local group on NT 4. 1

Status
Not open for further replies.

WildWest

Programmer
Apr 2, 2002
111
0
0
US
Does anyone have any sample code that will remove a user from a local group on NT 4? Thanks in advance!

 
'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


 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top