コード例 #1
0
ファイル: CredSSP.cs プロジェクト: yxbdali/PowerShell
        /// <summary>
        /// BeginProcessing method.
        /// </summary>
        protected override void BeginProcessing()
        {
            //If not running elevated, then throw an "elevation required" error message.
            WSManHelper.ThrowIfNotAdministrator();
            helper = new WSManHelper(this);
#if !CORECLR
            if (Environment.OSVersion.Version.Major < 6)
            {
                //OS is XP/Win2k3. Throw error.
                string message = helper.FormatResourceMsgFromResourcetext("CmdletNotAvailable");
                throw new InvalidOperationException(message);
            }
#endif
            //If not running elevated, then throw an "elevation required" error message.
            WSManHelper.ThrowIfNotAdministrator();

            // DelegateComputer cannot be specified when Role is other than client
            if ((delegatecomputer != null) && !Role.Equals(Client, StringComparison.OrdinalIgnoreCase))
            {
                string message = helper.FormatResourceMsgFromResourcetext("CredSSPRoleAndDelegateCannotBeSpecified",
                                                                          "DelegateComputer",
                                                                          "Role",
                                                                          Role,
                                                                          Client);

                throw new InvalidOperationException(message);
            }

            // DelegateComputer must be specified when Role is client
            if (Role.Equals(Client, StringComparison.OrdinalIgnoreCase) && (delegatecomputer == null))
            {
                string message = helper.FormatResourceMsgFromResourcetext("CredSSPClientAndDelegateMustBeSpecified",
                                                                          "DelegateComputer",
                                                                          "Role",
                                                                          Client);

                throw new InvalidOperationException(message);
            }

            if (Role.Equals(Client, StringComparison.OrdinalIgnoreCase))
            {
                EnableClientSideSettings();
            }

            if (Role.Equals(Server, StringComparison.OrdinalIgnoreCase))
            {
                EnableServerSideSettings();
            }
        }//End BeginProcessing()
コード例 #2
0
 protected override void BeginProcessing()
 {
     if (Environment.OSVersion.Version.Major >= 6)
     {
         WSManHelper.ThrowIfNotAdministrator();
         if (base.Role.Equals("Client", StringComparison.OrdinalIgnoreCase))
         {
             this.DisableClientSideSettings();
         }
         if (base.Role.Equals("Server", StringComparison.OrdinalIgnoreCase))
         {
             this.DisableServerSideSettings();
         }
         return;
     }
     else
     {
         WSManHelper wSManHelper = new WSManHelper(this);
         string      str         = wSManHelper.FormatResourceMsgFromResourcetext("CmdletNotAvailable", new object[0]);
         throw new InvalidOperationException(str);
     }
 }
コード例 #3
0
		protected override void BeginProcessing()
		{
			if (Environment.OSVersion.Version.Major >= 6)
			{
				WSManHelper.ThrowIfNotAdministrator();
				if (base.Role.Equals("Client", StringComparison.OrdinalIgnoreCase))
				{
					this.DisableClientSideSettings();
				}
				if (base.Role.Equals("Server", StringComparison.OrdinalIgnoreCase))
				{
					this.DisableServerSideSettings();
				}
				return;
			}
			else
			{
				WSManHelper wSManHelper = new WSManHelper(this);
				string str = wSManHelper.FormatResourceMsgFromResourcetext("CmdletNotAvailable", new object[0]);
				throw new InvalidOperationException(str);
			}
		}
コード例 #4
0
ファイル: CredSSP.cs プロジェクト: yxbdali/PowerShell
        /// <summary>
        /// begin processing method.
        /// </summary>
        protected override void BeginProcessing()
        {
#if !CORECLR
            if (Environment.OSVersion.Version.Major < 6)
            {
                //OS is XP/Win2k3. Throw error.
                WSManHelper helper  = new WSManHelper(this);
                string      message = helper.FormatResourceMsgFromResourcetext("CmdletNotAvailable");
                throw new InvalidOperationException(message);
            }
#endif
            //If not running elevated, then throw an "elevation required" error message.
            WSManHelper.ThrowIfNotAdministrator();

            if (Role.Equals(Client, StringComparison.OrdinalIgnoreCase))
            {
                DisableClientSideSettings();
            }

            if (Role.Equals(Server, StringComparison.OrdinalIgnoreCase))
            {
                DisableServerSideSettings();
            }
        }//End BeginProcessing()
コード例 #5
0
ファイル: CredSSP.cs プロジェクト: 40a/PowerShell
        /// <summary>
        /// BeginProcessing method.
        /// </summary>      
        protected override void BeginProcessing()
        {
            //If not running elevated, then throw an "elevation required" error message.
            WSManHelper.ThrowIfNotAdministrator();
            helper = new WSManHelper(this);
#if !CORECLR
            if (Environment.OSVersion.Version.Major < 6)
            {
                //OS is XP/Win2k3. Throw error.
                string message = helper.FormatResourceMsgFromResourcetext("CmdletNotAvailable");
                throw new InvalidOperationException(message);
            }
#endif
            //If not running elevated, then throw an "elevation required" error message.
            WSManHelper.ThrowIfNotAdministrator();

            // DelegateComputer cannot be specified when Role is other than client
            if ((delegatecomputer != null) && !Role.Equals(Client, StringComparison.OrdinalIgnoreCase))
            {
                string message = helper.FormatResourceMsgFromResourcetext("CredSSPRoleAndDelegateCannotBeSpecified",
                    "DelegateComputer",
                    "Role",
                    Role,
                    Client);

                throw new InvalidOperationException(message);
            }

            // DelegateComputer must be specified when Role is client
            if (Role.Equals(Client, StringComparison.OrdinalIgnoreCase) && (delegatecomputer == null))
            {
                string message = helper.FormatResourceMsgFromResourcetext("CredSSPClientAndDelegateMustBeSpecified",
                    "DelegateComputer",
                    "Role",
                    Client);

                throw new InvalidOperationException(message);
            }

            if (Role.Equals(Client, StringComparison.OrdinalIgnoreCase))
            {
                EnableClientSideSettings();
            }

            if (Role.Equals(Server, StringComparison.OrdinalIgnoreCase))
            {
                EnableServerSideSettings();
            }
        }//End BeginProcessing()
コード例 #6
0
ファイル: CredSSP.cs プロジェクト: 40a/PowerShell
        /// <summary>
        /// begin processing method.
        /// </summary>
        protected override void BeginProcessing()
        {
#if !CORECLR
            if (Environment.OSVersion.Version.Major < 6)
            {
                //OS is XP/Win2k3. Throw error.
                WSManHelper helper = new WSManHelper(this);
                string message = helper.FormatResourceMsgFromResourcetext("CmdletNotAvailable");
                throw new InvalidOperationException(message);
            }
#endif
            //If not running elevated, then throw an "elevation required" error message.
            WSManHelper.ThrowIfNotAdministrator();

            if (Role.Equals(Client, StringComparison.OrdinalIgnoreCase))
            {
                DisableClientSideSettings();
            }

            if (Role.Equals(Server, StringComparison.OrdinalIgnoreCase))
            {
                DisableServerSideSettings();
            }
        }//End BeginProcessing()