示例#1
0
        static void Main(string[] args)
        {
            PSFactory myPowershell = new PSFactory();

            if (myPowershell.openRunspace("dpfadmin", "Express10n!", "corpnet", "bil-corp12.corpnet.liox.org"))
            {
                // Start Basic and run a simple command in the runspace
                WriteResult(myPowershell.RunScript(new List <string> {
                    "Get-Service", "Get-Host"
                }));

                // Now, lets try our AD Utilities Library
                // Return the BitLocker Recover Keys for a System

                IEnumerable <BitLocker_KeySet> computerKeys = Bitlocker.Get_ADBitLockerRecoveryKeys(myPowershell, "BAL-DF-E6500");
                foreach (BitLocker_KeySet keySet in computerKeys)
                {
                    Console.WriteLine("Date Created : {0}", keySet.KeyDate);
                    Console.WriteLine("Machine ID   : {0}", keySet.MachineID);
                    Console.WriteLine("Recovery Key : {0}", keySet.RecoveryKey);
                }

                // Clean up Afterwards
                myPowershell.closeRunspace();
            }
            ////;

            ////WriteResult(myPowershell.RunScript(new List<string> { "hostname | write-host" }));
            ////WriteResult(myPowershell.RunScript(new List<string> { "a=1+2" }));


            //myPowershell.closeRunspace();
        }
        public void Execute(IActivityRequest request, IActivityResponse response)
        {
            //response.WithFiltering().PublishRange(runCommand(request.Inputs["Computer Name"].AsString()));

            string strComputer = request.Inputs["Computer Name"].AsString();

            PSFactory myPowershell = new PSFactory();

            if (myPowershell.openRunspace(connection.UserName, connection.Password, connection.Domain, connection.Host))
            {
                IEnumerable <BitLocker_KeySet> computerKeys = Bitlocker.Get_ADBitLockerRecoveryKeys(myPowershell, "BAL-DF-E6500");
                int numKeys = response.WithFiltering().PublishRange(computerKeys);
                response.Publish("Number of Keys", numKeys);

                myPowershell.closeRunspace();
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            PSFactory myPowershell = new PSFactory();

            if (myPowershell.openRunspace("dpfadmin", "Express10n!", "corpnet", "bil-corp12.corpnet.liox.org"))
            {
                // Start Basic and run a simple command in the runspace
                WriteResult(myPowershell.RunScript(new List <string> {
                    "Get-Service", "Get-Host"
                }));

                // Now, lets try our AD Utilities Library
                // Return the BitLocker Recover Keys for a System

                IEnumerable <WU_RebootStatus> rebootState = WU_Activities.Get_RebootStatus(myPowershell, "BAL-DF-E6500");
                foreach (WU_RebootStatus computerRebootState in rebootState)
                {
                    Console.WriteLine("Pending Reboot : {0}", computerRebootState.PendingReboot);
                }

                // Clean up Afterwards
                myPowershell.closeRunspace();
            }
        }