Advertisement
Guest User

Untitled

a guest
Jun 12th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. $assemblies=(
  2. "System",
  3. "Microsoft.Win32"
  4. )
  5.  
  6. $source=@"
  7. using System;
  8. using Microsoft.Win32;
  9. namespace Helloworld
  10. {
  11. public static class Hello{
  12. static void Main(string[] args)
  13. {
  14. RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
  15. //deleting 'someKey'
  16. key.DeleteSubKey("someKey");
  17. key.Close();
  18. }
  19. }
  20. }
  21. "@
  22. Add-Type -ReferencedAssemblies $assemblies -TypeDefinition $source -Language CSharp
  23.  
  24. [HelloWorld.Hello]::Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement