Пример #1
0
        public async Task <string> Get_Quicktime()
        {
            Processing++;
            string argument = string.Empty;

            Quicktime = "Updating...";

            if (x64 == true)
            {
                argument = @"Program Files (x86)";
            }
            else
            {
                argument = @"Program Files";
            }

            var paexec = new Tool.PAExec(IPAddress, string.Format(@"wmic datafile where name='C:\\{0}\\Quicktime\\QuickTimePlayer.exe' get version", argument));
            await paexec.Run();

            if (paexec.StandardError.Contains("No Instance(s) Available."))
            {
                Quicktime = "NOT INSTALLED";
            }
            else
            {
                Quicktime = paexec.StandardOutput.Remove(0, 7).Trim();
            }
            Processing--;
            Log(log.Trace, "Quicktime version: " + Quicktime);
            return(Quicktime);
        }
Пример #2
0
        public async Task KillDefaults()
        {
            Processing++;
            Log(log.Info, "Killing Default Tasks on Remote");
            var killbatch = new Tool.PAExec(IPAddress, @"-accepteula -realtime -s c:\temp\defaultkills.bat", string.Format(@"{0}\Resources\defaultkills.bat", Environment.CurrentDirectory));
            await killbatch.Run();

            //var gettasks = new Tool.PAExec(IPAddress, @"-accepteula -realtime -s tasklist");
            //await gettasks.Run();
            ////Looks at tasks returned and only kills open tasks.

            //var processes = new List<string>()
            //{
            //    "iexplore.exe", "msiexec.exe", "javaws.exe", "javaws.exe", "jusched.exe"
            //};

            //foreach (string process in processes)
            //{
            //    if (gettasks.StandardOutput.Contains(process))
            //    {
            //        Log(log.Info, "Killing Task(s) {0}", process);
            //        var kill = new Tool.PSKill(IPAddress, process);
            //        await kill.Run();
            //    }
            //}
            Processing--;
        }
Пример #3
0
        public async Task Get_MachineInfo()
        {
            Processing++;
            var machineInfo = CommandList.Find(c => c.Name == "MachineInfo");

            Tool.PAExec paexec = new Tool.PAExec(IPAddress, machineInfo.Command);
            await paexec.Run();

            string Info = paexec.StandardOutput.Replace("\r\r\r\nNode,SystemType,TotalPhysicalMemory,UserName\r\r\r\n", string.Empty).Trim(null);

            string[] InfoArray = Info.Split(',');
            PCName      = InfoArray[0];
            ChipStyle   = InfoArray[1];
            RAM         = BytesToString(Convert.ToInt64(InfoArray[2]));
            CurrentUser = InfoArray[3].ToLower().Replace("ecotoh\\", string.Empty);

            Log(log.Trace, "Name: {0} ChipStyle: {1} RAM: {2} CurrentUser {3}", PCName, ChipStyle, RAM, CurrentUser);

            if (PCName.Contains("ECT-"))
            {
                IsStaff = false;
                await Get_StudentImageInfo();
            }
            else
            {
                IsStaff = true;
                BOD     = VPN = Image = "N/A";
            }
            Processing--;
        }
Пример #4
0
        public async Task FixBackGround()
        {
            Processing++;
            var bg = new Tool.PAExec(IPAddress, @"-i 1 -s -accepteula c:\image_files\bginfo\bginfo.exe /nolicprompt c:\image_files\bginfo\wallpaper.bgi /timer:0 /silent");
            await bg.Run();

            //Fix theme too
            var theme = new Tool.PAExec(IPAddress, @"-i 1 -s -accepteula cmd.exe /c c:\windows\resources\themes\ecot.theme");
            await theme.Run();

            Processing--;
        }
Пример #5
0
        private async Task <string> WMICVersion(List <string> paths)
        {
            foreach (string path in paths)
            {
                var file = new Tool.PAExec(IPAddress, string.Format(@"wmic datafile where name='{0}' get version", path));
                await file.Run();

                if (!file.StandardError.Contains("No Instance(s) Available") && !file.StandardError.Contains("Invalid query"))
                {
                    return(file.StandardOutput.Remove(0, 7).Trim(null));
                }
            }
            return("NOT INSTALLED");
        }
Пример #6
0
        public async Task <string> Get_IE()
        {
            Processing++;
            IEVersion = "Updating...";
            var machineInfo = CommandList.Find(c => c.Name == "IE");

            Tool.PAExec paexec = new Tool.PAExec(IPAddress, machineInfo.Command);
            await paexec.Run();

            IEVersion = paexec.StandardOutput.Replace("Version", string.Empty).Trim();
            Log(log.Trace, "IE: {0}", IEVersion);
            Processing--;
            return(IEVersion);
        }
Пример #7
0
        public async Task ProfileBackup()
        {
            Processing++;
            var desktop   = new Tool.PAExec(IPAddress, string.Format(@"robocopy c:\users\{0}\Desktop c:\temp\profilebackup\{0}\Desktop /E /R:0", CurrentUser));
            var documents = new Tool.PAExec(IPAddress, string.Format(@"robocopy c:\users\{0}\Documents c:\temp\profilebackup\{0}\Documents /E /R:0", CurrentUser));

            Log(log.Info, @"Backuping up \Desktop for " + CurrentUser);
            await desktop.Run();

            Log(log.Info, @"Backuping up \Documents for " + CurrentUser);
            await documents.Run();

            Log(log.Info, string.Format("Profile backup complete for {0}", CurrentUser));
            Processing--;
        }
Пример #8
0
        public async Task FileCleanup()
        {
            Processing++;
            Log(log.Info, "Starting remote file cleanup");
            //int filenumber, directorynumber, errornumber;
            //filenumber = directorynumber = errornumber = 0;
            string f = @"resources\FileDeleteList.txt";

            // 1
            // Declare new List.
            List <string> lines = new List <string>();

            // 2
            // Use using StreamReader for disposing.
            using (StreamReader r = new StreamReader(f, System.Text.Encoding.ASCII))
            {
                // 3
                // Use while != null pattern for loop
                string line;
                while ((line = r.ReadLine()) != null)
                {
                    // 4
                    // Insert logic here.
                    // ...
                    // "line" is a line in the file. Add it to our List.
                    if (line.Contains("USERNAME"))
                    {
                        line = line.Replace("USERNAME", CurrentUser);
                    }
                    lines.Add(string.Format("cmd /C RMDIR /S /Q {0}", line));
                }
            }

            // 5
            // Use lines to delete remote dirs.
            foreach (string s in lines)
            {
                Log(log.Info, "Deleting remote folder: " + s.Replace("cmd /C RMDIR /S /Q ", string.Empty));
                var paexec = new Tool.PAExec(IPAddress, s);
                await paexec.Run();
            }
            var x = new Tool.Files();

            x.Copy(@"\\fs1\HelpDesk\SHORTCUTS\Clear_IE_Cache.lnk", string.Format(@"\\{0}\c$\Users\{1}\Desktop\", IPAddress, CurrentUser));
            Log(log.Info, "Copied Clear_IE_Cache.lnk to Remote Desktop for clearing cache in IE. ");
            Processing--;
            Log(log.Info, "File cleanup complete");
        }
Пример #9
0
        private async Task <string> JavaVersion(string command)
        {
            string result = string.Empty;
            var    paexec = new Tool.PAExec(IPAddress, command);
            await paexec.Run();

            if (paexec.StandardError.Contains("java version") == true)
            {
                result = paexec.StandardError.Split(new char[] { '\"', '\"' })[1];
            }
            else
            {
                result = "ERROR";
            }
            return(result);
        }
Пример #10
0
        public async Task <string> Get_Flash()
        {
            Processing++;
            Flash = "Updating...";
            var paexec = new Tool.PAExec(IPAddress, @"-accepteula -s REG query hklm\Software\Macromedia\FlashPlayerActiveX /v Version");
            await paexec.Run();

            if (paexec.StandardError.Contains("The system was unable to find the specified registry key or value"))
            {
                Flash = "NOT INSTALLED";
            }
            else
            {
                Flash = paexec.StandardOutput.Replace("\r\r\nHKEY_LOCAL_MACHINE\\Software\\Macromedia\\FlashPlayerActiveX\r\r\n    Version    REG_SZ    ", string.Empty).Trim(null);
            }
            Processing--;
            Log(log.Trace, "Flash version: " + Flash);
            return(Flash);
        }
Пример #11
0
        public async Task <string> Get_Reader()
        {
            Processing++;
            string argument = string.Empty;

            Reader = "Updating...";
            //_tools.Copy(Settings.General.Default.sigcheck, Settings.General.Default.remote_folder);
            if (x64 == true)
            {
                argument = @"Program Files (x86)";
            }
            else
            {
                argument = @"Program Files";
            }

            var r11 = new Tool.PAExec(IPAddress, string.Format(@"wmic datafile where name='C:\\{0}\\Adobe\\Reader 11.0\\Reader\\AcroRd32.exe' get version", argument));
            await r11.Run();

            if (r11.StandardError.Contains("No Instance(s) Available"))
            {
                var r10 = new Tool.PAExec(IPAddress, string.Format(@"wmic datafile where name='C:\\{0}\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe' get version", argument));
                await r10.Run();

                if (r10.StandardError.Contains("No Instance(s) Available"))
                {
                    Reader = "NOT INSTALLED";
                }
                else
                {
                    Reader = r10.StandardOutput.Remove(0, 7).Trim(null);
                }
            }
            else
            {
                Reader = r11.StandardOutput.Remove(0, 7).Trim(null);
            }
            Processing--;
            Log(log.Debug, "Reader version: " + Reader);
            return(Reader);
        }
Пример #12
0
        public async Task UnlockTaskbar()
        {
            Log(log.Info, "Unlocking Taskbar...");
            Processing++;
            var f = new NTAccount(CurrentUser);
            var s = (SecurityIdentifier)f.Translate(typeof(SecurityIdentifier));

            var unlocktb = new Tool.PAExec(IPAddress, string.Format(@"-s Reg add HKEY_USERS\{0}\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v TaskbarSizeMove /t REG_DWORD /d 1 /f", s.ToString()));

            try
            {
                await unlocktb.Run();

                Processing--;
                Log(log.Info, "Taskbar unlocked. A restart is required.");
            }
            catch (Exception ex)
            {
                Processing--;
                Log(log.Error, ex.ToString());
            }
        }
Пример #13
0
        protected async Task Get_StudentImageInfo()
        {
            var machineInfo = CommandList.Find(c => c.Name == "Image");

            Log(log.Debug, "Acquiring Image information...");
            var paexec = new Tool.PAExec(IPAddress, machineInfo.Command);
            await paexec.Run();

            Image = paexec.StandardOutput.Replace("\r\r\nHKEY_LOCAL_MACHINE\\Software\\ecot\r\r\n    Image Version    REG_SZ    ", string.Empty).TrimEnd(null);
            Log(log.Trace, "Image: " + Image);

            Log(log.Debug, "Acquiring BOD...");
            string f = @"\\" + IPAddress.ToString() + @"\c$\Image_Files\Bginfo\Born on date.txt";

            using (StreamReader r = new StreamReader(f, System.Text.Encoding.ASCII))
            {
                BOD = r.ReadToEnd();
                Log(log.Trace, "BOD:" + BOD);
            }

            Get_VPN();
        }
Пример #14
0
        public async Task <bool> SetJNLPAssoication(RemoteProgramData toset)
        {
            if (toset == null)
            {
                return(false);
            }
            if (Javas.Any(j => j.FullVersion.ToLower().Contains("not installed")) || Javas.Count == 0 || Javas == null)
            {
                return(false);
            }
            Log(log.Info, string.Format("Setting .jnlp file association to {0}", toset.FullVersion));
            Processing++;
            try
            {
                var f = new NTAccount(CurrentUser);
                var s = (SecurityIdentifier)f.Translate(typeof(SecurityIdentifier));

                var fixreg = new Tool.PAExec(IPAddress, string.Format(@"-s REG DELETE ""HKU\{0}\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jnlp\UserChoice"" /v Progid /f", s.ToString()));
                await fixreg.Run();

                var assoc = new Tool.PAExec(IPAddress, @"cmd /c assoc .jnlp=jnlpfile");
                await assoc.Run();

                var paexec = new Tool.PAExec(IPAddress, string.Format(@"cmd /c ftype jnlpfile=""{0}\bin\javaws.exe"" ""%1""", toset.FullPath));
                await paexec.Run();

                Log(log.Info, "Process complete");

                Processing--;
                return(true);
            }
            catch (Exception ex)
            {
                Log(log.Error, ex.ToString());
                Processing--;
                return(false);
            }
        }
Пример #15
0
        public async Task ProfileWipe_Enable()
        {
            Processing++;

            var UserProfileServiceFix = new Tool.PAExec(IPAddress, @"-accepteula -realtime -s icacls c:\Users\Default\*  /inheritance:e /T /C");
            await UserProfileServiceFix.Run();

            var file = new Tool.Files();

            file.EventLogged += PassEventLogged;
            await Task.Run(() => file.Copy(@"\\fs1\HelpDesk\TOOLS\3rdParty\Delprof2 1.5.4", string.Format(@"\\{0}\c$\temp\Delprof2_1.5.4\", IPAddress)));

            file.EventLogged -= PassEventLogged;

            var add1 = new Tool.StandardProcess(@"c:\windows\system32\", "schtasks.exe", string.Format(@"/create /s \\{0} /sc onstart /delay 0000:10 /rl HIGHEST /ru SYSTEM /tn ""Profile wipe"" /tr ""c:\temp\Delprof2_1.5.4\delprof2.exe /u /id:{1}""", IPAddress.ToString(), CurrentUser));
            var add2 = new Tool.StandardProcess(@"c:\windows\system32\", "schtasks.exe", @"/create /s \\" + IPAddress.ToString() + @"  /sc onlogon /ru SYSTEM /tn ""remove wipe"" /tr ""c:\temp\Delprof2_1.5.4\remove.bat""");
            await add1.Run();

            await add2.Run();

            Processing--;
            Log(log.Info, "Profile Wipe ENABELED on next boot.");
        }
Пример #16
0
        public async Task Get_OSBitness()
        {
            Processing++;
            var machineInfo = CommandList.Find(c => c.Name == "Bittness");

            Tool.PAExec paexec = new Tool.PAExec(IPAddress, machineInfo.Command);
            await paexec.Run();

            string Info = paexec.StandardOutput.Replace("\r\r\r\nNode,OSArchitecture\r\r\r\n", string.Empty).Trim(null);

            string[] InfoArray = Info.Split(',');
            OSBit = InfoArray[1];
            if (OSBit == "64-bit")
            {
                x64 = true;
            }
            else
            {
                x64 = false;
            }

            Log(log.Trace, "OSBit: {0}", OSBit);
            Processing--;
        }