Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. namespace ST_f70ca8889a244cbfa56af3a42878c645
  5. {
  6. [Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
  7. public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
  8. {
  9. public void Main()
  10. {
  11. bool fireAgain = false;
  12.  
  13. //Get Drives info
  14. Dts.Events.FireInformation(3, "Drives", "Drives - Begin", "", 0, ref fireAgain);
  15. foreach (DriveInfo d in DriveInfo.GetDrives())
  16. {
  17. if (d.IsReady)
  18. {
  19. string info = String.Format("Name: \"{0}\", Label: \"{1}\", Total size: {2}Gb, Available free space: {3}Gb", d.Name, d.VolumeLabel, d.TotalSize / 1024 / 1024 / 1024, d.AvailableFreeSpace / 1024 / 1024 / 1024);
  20. Dts.Events.FireInformation(3, "Drives", " | " + info, "", 0, ref fireAgain);
  21. }
  22. }
  23. Dts.Events.FireInformation(3, "Drives", "Drives - End", "", 0, ref fireAgain);
  24. }
  25. }
  26.  
  27. #region ScriptResults declaration
  28. /// <summary>
  29. /// This enum provides a convenient shorthand within the scope of this class for setting the
  30. /// result of the script.
  31. ///
  32. /// This code was generated automatically.
  33. /// </summary>
  34. enum ScriptResults
  35. {
  36. Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
  37. Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
  38. };
  39. #endregion
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement