Example #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();
        }
Example #2
0
        public static void Callback(string dev)
        {
            Console.WriteLine("Locking...");
            Task         t   = Bitlocker.LockAllDrives();
            KeepassXCApi api = new();

            api.LockDatabase().Wait();
            t.Wait();
        }
        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();
            }
        }
Example #4
0
        public void TestCanFindDrivesAsync()
        {
            IEnumerable <string> drives = Bitlocker.GetBitlockerDrives();

            Assert.IsNotEmpty(drives);
        }