/Source/NewFIMSession.cs

# · C# · 41 lines · 31 code · 3 blank · 7 comment · 0 complexity · de81d906b7f213b05fd7e1534654fc87 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Management.Automation;
  6. namespace Quest.FIMPowerShellSnapin
  7. {
  8. /// <summary>
  9. /// Class that defines the New-FIMSession cmdlet
  10. /// </summary>
  11. [Cmdlet(VerbsCommon.New, Constants.Nouns.FIMSession)]
  12. public class NewFIMSession : PSCmdlet
  13. {
  14. [Parameter(ValueFromPipeline = true)]
  15. [ValidateNotNullOrEmpty]
  16. public PSCredential Credential
  17. {
  18. get;
  19. set;
  20. }
  21. [Parameter(Mandatory = true)]
  22. [ValidateNotNullOrEmpty]
  23. public string Server
  24. {
  25. get;
  26. set;
  27. }
  28. /// <summary>
  29. /// Use the Server and Credential parameters to create a new FIMPSSession, and output that to the Powershell pipeline. Allow the
  30. /// PS host to handle any exceptions.
  31. /// </summary>
  32. protected override void ProcessRecord()
  33. {
  34. FIMPSSession session = new FIMPSSession(Server, Credential, Host);
  35. WriteObject(session);
  36. }
  37. }
  38. }