Ejemplo n.º 1
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));
        }
        public async Task <Win32LobAppPowerShellScriptDetection> GetWin32MobileAppPowerShellDetectionRuleAsync(string id)
        {
            var resource = graphServiceClient.DeviceAppManagement.MobileApps[id].Request();

            signalRMessage.sendMessage($"GET: {resource.RequestUrl}");
            Win32LobApp app = (Win32LobApp)await resource.GetAsync();

            Win32LobAppPowerShellScriptDetection powerShellScriptDetection = app.DetectionRules.Where(rule => rule.ODataType.Equals("#microsoft.graph.win32LobAppPowerShellScriptDetection")).Cast <Win32LobAppPowerShellScriptDetection>().First();

            signalRMessage.sendMessage(JsonConvert.SerializeObject(powerShellScriptDetection));
            return(powerShellScriptDetection);
        }
Ejemplo n.º 3
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"));
            }
        }