Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Management.Automation;
  5. using System.Collections;
  6. using System.IO;
  7. using System.Runtime.InteropServices;
  8.  
  9. namespace WindowsPowerShell2
  10. {
  11. [Cmdlet(VerbsCommon.Remove, "Profile", SupportsShouldProcess = true)]
  12.  
  13.  
  14. public class DeleteProfiler : PSCmdlet
  15.  
  16.  
  17.  
  18. {
  19.  
  20.  
  21.  
  22. [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Ansi,
  23. EntryPoint = "DeleteProfileA")]
  24. public static unsafe extern bool DeleteProfile(string Palabra);
  25.  
  26.  
  27.  
  28. #region Parameters
  29.  
  30. [Parameter( Mandatory = true)]
  31. [ValidateNotNullOrEmpty]
  32. public string SecurityID
  33. {
  34. get { return sid; }
  35. set { sid = value; }
  36. }
  37.  
  38. private string sid;
  39. #endregion
  40.  
  41. protected unsafe override void ProcessRecord()
  42. {
  43.  
  44. base.ProcessRecord();
  45.  
  46.  
  47. try
  48. {
  49. DeleteProfile(sid);
  50. }
  51. catch (Exception)
  52. {
  53. }
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement