예제 #1
0
        public async Task <ActionResult> Win32AppDetectionScripts()
        {
            try
            {
                GraphIntune graphIntune = new GraphIntune(null);
                var         apps        = await graphIntune.GetWin32MobileAppsAsync();

                List <Win32LobApp> win32LobApps = new List <Win32LobApp>();

                foreach (Win32LobApp app in apps)
                {
                    var details = await graphIntune.GetWin32MobileAppAsync(app.Id);

                    if (details.DetectionRules.Any(d => d is Win32LobAppPowerShellScriptDetection))
                    {
                        win32LobApps.Add(details);
                    }
                }

                return(View(win32LobApps));
            }
            catch (ServiceException e)
            {
                Flash(e.Error.Message);
                return(RedirectToAction("Index", "Home"));
            }
        }
예제 #2
0
        public async System.Threading.Tasks.Task <ViewResult> Win32AppDetectionScripts()
        {
            try
            {
                GraphIntune graphIntune = new GraphIntune(null);
                var         apps        = await graphIntune.GetWin32MobileAppsAsync();

                List <Win32LobApp> win32LobApps = new List <Win32LobApp>();

                foreach (Win32LobApp app in apps)
                {
                    var details = await graphIntune.GetWin32MobileAppAsync(app.Id);

                    if (details.DetectionRules.Any(d => d is Win32LobAppPowerShellScriptDetection))
                    {
                        win32LobApps.Add(details);
                    }
                }

                return(View(win32LobApps));
            }
            catch (Exception e)
            {
                Flash("Error " + e.Message.ToString());
                return(View());
            }
        }
예제 #3
0
        public async System.Threading.Tasks.Task <FileResult> DownloadDetectionScript(string Id)
        {
            GraphIntune graphIntune = new GraphIntune(null);
            Win32LobApp win32LobApp = await graphIntune.GetWin32MobileAppAsync(Id);

            Win32LobAppPowerShellScriptDetection script = await graphIntune.GetWin32MobileAppPowerShellDetectionRuleAsync(Id);

            string fileName = $"{FilenameHelper.ProcessFileName(win32LobApp.DisplayName)}_detect.ps1";

            return(File(Convert.FromBase64String(script.ScriptContent), "text/plain", fileName));
        }
예제 #4
0
        public async Task <ActionResult> DownloadDetectionScript(string Id)
        {
            try
            {
                GraphIntune graphIntune = new GraphIntune(null);
                Win32LobApp win32LobApp = await graphIntune.GetWin32MobileAppAsync(Id);

                Win32LobAppPowerShellScriptDetection script = await graphIntune.GetWin32MobileAppPowerShellDetectionRuleAsync(Id);

                string fileName = $"{FilenameHelper.ProcessFileName(win32LobApp.DisplayName)}_detect.ps1";
                return(File(Convert.FromBase64String(script.ScriptContent), "text/plain", fileName));
            }
            catch (ServiceException e)
            {
                Flash(e.Error.Message);
                return(RedirectToAction("Index", "Home"));
            }
        }