PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/NewFIMSession.cs

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