get name intune script from local computer

mehdi dakhama 336 Reputation points MVP
2020-11-04T12:00:08.45+00:00

Hi, i want get the name no GUID of script intune from local computer ?? i was see the log and regedit but not found anythings thanks community

Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
5,088 questions
0 comments No comments
{count} votes

Accepted answer
  1. Crystal-MSFT 48,766 Reputation points Microsoft Vendor
    2020-11-05T03:18:33.233+00:00

    @mehdidakhama-6198, Based as I know the script we download from Intune is identified with id. So on local computer, we can only see the id in both registry key and log file. To find out the script name of the id, we can get it from intune Graph:

    Here is the test I have done in my lab
    In my log and registry , I find my script id is as below:
    37510-image.png

    Then open Powershell ISE with administrator permission, and run the following script:

    Import-Module Microsoft.Graph.Intune #import intune module  
      
    Update-MSGraphEnvironment -SchemaVersion beta #set schema version as beta  
    Connect-MSGraph  #connect to MS grasp  
      
    Function Get-IScript {  
    <#  
    .SYNOPSIS  
    Get-IScript retrieves one or more scripts.  
    .DESCRIPTION  
    Get-IScript retrieves one or more scripts.  
    .PARAMETER id   
    The id of the script policy.  
    .EXAMPLE  
    Get-IScript -id "script id"  
    #>  
        Param($id)  
        $URI = "deviceManagement/deviceManagementScripts"  
        $IntuneScripts = Invoke-MSGraphRequest -HttpMethod GET -Url $URI  
        If ($IntuneScripts.value)  
        {  
            $IntuneScripts = $IntuneScripts.value  
        }  
        $IntuneScript = $IntuneScripts | Where {$_.id -eq $id}  
        If ($id)  
        {   
            Return $IntuneScript  
        }  
        else  
        {  
            Return $IntuneScripts  
        }  
    }  
    

    It will pop windows and needs to enter intune administrator credential

    After it is connected, run the command like below:
    Get-IScript -id "script id" | fl filename
    Note: Please change the script id to the one in your environment.

    Then we can get the name:
    37631-image.png

    Hope it can help.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. mehdi dakhama 336 Reputation points MVP
    2020-11-05T11:07:35.627+00:00

    Hi,
    thank you for reply, good script, I appreciate a lot, but I had an error, in addition the user will have to download the module at the limit this part it does not matter, because I can introduce the module sillent in an app, but it didn't get me anything, and I don't know if you need a specific authorization
    37660-1.png

    0 comments No comments

  2. mehdi dakhama 336 Reputation points MVP
    2020-11-05T11:12:52.157+00:00

    How can i contact you ? i m working now on a GUI tool, that i can deploy en msi from intune on remote computer, and will be show the GUID, Stat of script error
    that can also force refresh the local script and force to re-run only on script, it will be help many people,
    it is a free GUI, lite and fast

    37666-2.png


  3. mehdi dakhama 336 Reputation points MVP
    2020-11-06T10:59:38.323+00:00

    Hi,
    thank you for reply, i will soon share my code and my tool, but i dont know where to post it because gallery is closed, i think it will help the community


  4. mehdi dakhama 336 Reputation points MVP
    2020-11-10T19:42:24.39+00:00

    Thanks, i will share it tomorrow with code source also, i m soo tried today


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.