Paulchen Posted August 25, 2008 Share Posted August 25, 2008 How can I write a AutoIT Script that use the WinApi DeleteProfile?How can I define a NULL Parameter?More Documentation about the function can be found here:http://msdn.microsoft.com/en-us/library/bb762273(VS.85).aspx....Deletes the user profile and all user-related settings from the specified computer. The caller must have administrative privileges to delete a user's profile.BOOL WINAPI DeleteProfile( LPCTSTR lpSidString, LPCTSTR lpProfilePath, LPCTSTR lpComputerName);ParameterslpSidString[in] Pointer to a string that specifies the user SID.lpProfilePath[in] Pointer to a string that specifies the profile path. If this parameter is NULL, the function obtains the path from the registry.lpComputerName[in] Pointer to a string that specifies the name of the computer from which the profile is to be deleted. If this parameter is NULL, the local computer name is used.Return Value.... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 25, 2008 Moderators Share Posted August 25, 2008 "ptr", 0 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulchen Posted August 26, 2008 Author Share Posted August 26, 2008 Thank you Now I write a little sample. ;http://msdn.microsoft.com/en-us/library/bb762273(VS.85).aspx #RequireAdmin #include <Security.au3> Dim $ACCOUNT = "Test1"; Replace this Account but be carefully ConsoleWrite("get the SID from UserID " & $ACCOUNT & @CRLF) $ArrSid = _Security__LookupAccountName($ACCOUNT) If @error Then ConsoleWrite("Errorcode:" & @error & " Extendedcode: " & @extended & @CRLF) Exit 1 EndIf ConsoleWrite("UserID " & $ACCOUNT & " have the SID " & $ArrSid[0] & @CRLF) ConsoleWrite("try to delete Profile " & $ACCOUNT & @CRLF) $Return = DllCall("Userenv.dll", "int", "DeleteProfile", "str", $ArrSid[0], "ptr", 0, "ptr", 0) If @error Then ConsoleWrite("Returncode:" & $Return & " Errorcode:" & @error & " Extendedcode: " & @extended & @CRLF) Exit 2 EndIf if $Return[0]= 1 then ConsoleWrite("Successfull" & @CRLF) Else ConsoleWrite("Profile couldn't delete, mabye not exist" & @CRLF) EndIf Link to comment Share on other sites More sharing options...
rasim Posted August 26, 2008 Share Posted August 26, 2008 PaulchenMaybe this be easy?How to Use the Net User Command Link to comment Share on other sites More sharing options...
Paulchen Posted August 26, 2008 Author Share Posted August 26, 2008 PaulchenMaybe this be easy?How to Use the Net User CommandThat's not the same. The net user delete the account an not the Profile, deleteprofile function delete only the profile. Link to comment Share on other sites More sharing options...
rasim Posted August 26, 2008 Share Posted August 26, 2008 PaulchenThat's not the same. The net user delete the account an not the Profile, deleteprofile function delete only the profile.Understand. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now