コード例 #1
0
ファイル: ComputerDetails.cs プロジェクト: TomasVetrik/GDS
        public void SetComputerDetails()
        {
            try
            {
                computerDetails = new List <string>();
                computerDetailsData.RealPCName = System.Environment.MachineName;
                computerDetails.Add("Computer Name||" + computerDetailsData.RealPCName);

                var MacAddress = HardwareInfo.GetMacAddresses();
                if (MacAddress.Count == 0)
                {
                    SetComputerDetails();
                    return;
                }

                computerDetailsData.macAddresses = MacAddress;
                computerDetailsData.MacAddress   = MacAddress[0];
                computerDetails.Add("MacAddress||" + MacAddress);
                computerDetailsData.OSInformations = HardwareInfo.GetOSInformation();
                computerDetails.Add("OS Informations||" + computerDetailsData.OSInformations);
                computerDetailsData.processorInfo = HardwareInfo.GetProcessorInformation();
                computerDetails.Add("Processor Informations||" + computerDetailsData.processorInfo);
                computerDetailsData.physicalMemoryInfo = HardwareInfo.GetPhysicalMemory();
                computerDetails.Add("Memory Size||" + computerDetailsData.physicalMemoryInfo);
                computerDetailsData.numberOfRamSLots = HardwareInfo.GetNoRamSlots();
                computerDetails.Add("Used Memory Slots||" + computerDetailsData.numberOfRamSLots);
                computerDetailsData.biosCaption = HardwareInfo.GetBIOScaption();
                computerDetails.Add("BIOS Caption||" + computerDetailsData.biosCaption);
                computerDetailsData.boardProductId = HardwareInfo.GetBoardProductId();
                computerDetails.Add("Board ID||" + computerDetailsData.boardProductId);
                computerDetailsData.accountName = HardwareInfo.GetAccountName();
                computerDetails.Add("User Account Name||" + computerDetailsData.accountName);
                computerDetailsData.baseImageName = GetBaseImageName();
                computerDetails.Add("BASE NAME||" + computerDetailsData.baseImageName);
                computerDetailsData.driveEImageName = GeDriveEImageName();
                computerDetails.Add("DRIVEE NAME||" + computerDetailsData.driveEImageName);
                computerDetailsData.dartInfo = GetDartViewerInfo(0);
                computerDetails.Add("Dart Viewer||" + computerDetailsData.dartInfo + "END");
            }
            catch
            {
                Console.WriteLine("SOMETHING WRONG WITH GET COMPUTER DETAILS");
                Thread.Sleep(5000);
                SetComputerDetails();
            }
        }
コード例 #2
0
        public void SetComputerDetails()
        {
            try
            {
                Console.WriteLine("LOOP");
                computerDetails = new List <string>();
                computerDetailsData.RealPCName = System.Environment.MachineName;
                computerDetails.Add("Computer Name||" + computerDetailsData.RealPCName);

                var MacAddress = HardwareInfo.GetMacAddresses();
                if (MacAddress.Count == 0)
                {
                    var Macs = HardwareInfo.GetMacAddresses2();
                    if (Macs.Count == 0)
                    {
                        SetComputerDetails();
                        return;
                    }
                    MacAddress = Macs;
                }
                Console.WriteLine("LOOP 2");
                computerDetailsData._sourceIdentifier = NetworkComms.NetworkIdentifier;
                computerDetailsData.macAddresses      = MacAddress;
                computerDetailsData.MacAddress        = MacAddress[0];
                computerDetails.Add("MacAddress||" + MacAddress);
                computerDetailsData.OSInformations = HardwareInfo.GetOSInformation();
                computerDetails.Add("OS Informations||" + computerDetailsData.OSInformations);
                computerDetailsData.processorInfo = HardwareInfo.GetProcessorInformation();
                computerDetails.Add("Processor Informations||" + computerDetailsData.processorInfo);
                computerDetailsData.physicalMemoryInfo = HardwareInfo.GetPhysicalMemory();
                computerDetails.Add("Memory Size||" + computerDetailsData.physicalMemoryInfo);
                computerDetailsData.numberOfRamSLots = HardwareInfo.GetNoRamSlots();
                computerDetails.Add("Used Memory Slots||" + computerDetailsData.numberOfRamSLots);
                computerDetailsData.biosCaption = HardwareInfo.GetBIOScaption();
                computerDetails.Add("BIOS Caption||" + computerDetailsData.biosCaption);
                Console.WriteLine("LOOP 3");
                computerDetailsData.boardProductId = HardwareInfo.GetBoardProductId();
                computerDetails.Add("Board ID||" + computerDetailsData.boardProductId);
                computerDetailsData.accountName = HardwareInfo.GetAccountName();
                computerDetails.Add("User Account Name||" + computerDetailsData.accountName);
                computerDetailsData.baseImageName = GetBaseImageName();
                computerDetails.Add("BASE NAME||" + computerDetailsData.baseImageName);
                computerDetailsData.driveEImageName = GeDriveEImageName();
                computerDetails.Add("DRIVEE NAME||" + computerDetailsData.driveEImageName);
                computerDetailsData.dartInfo = GetDartViewerInfo(0);
                computerDetails.Add("Dart Viewer||" + computerDetailsData.dartInfo);
                computerDetailsData.CustomLog = "";
                if (!computerDetailsData.inWinpe)
                {
                    computerDetailsData.CustomLog = RunScript("$Templates = Get-SCVMTemplate\n"
                                                              + "foreach ($Template in $Templates){$Template.Name}");
                }
                computerDetails.Add("Custom Log||" + computerDetailsData.CustomLog);
                Console.WriteLine("LOOP 4");
            }
            catch (Exception ex)
            {
                WriteToLogs("SOMETHING WRONG WITH GET COMPUTER DETAILS: " + ex.ToString());
                Console.WriteLine("SOMETHING WRONG WITH GET COMPUTER DETAILS");
                Thread.Sleep(5000);
                SetComputerDetails();
            }
        }