SCCMTSPSI
  • Task Sequence UI
  • Documentation
  • Download
  • SCCM Reports & Tools
    • Software Updates Dashboard
    • Monthly Software Update Compliance SSRS Report
  • Get in touch
    Sign in
    SCCMTSPSI
    SCCMTSPSI
    • Task Sequence UI
    • Documentation
    • Download
    • SCCM Reports & Tools
      • Software Updates Dashboard
      • Monthly Software Update Compliance SSRS Report
    • Get in touch

    Author: Topaz George

    SCCM Monthly Software Update Compliance Reporting

    Reporting on software update compliance of workstation devices in SCCM brings with it varying levels of complexities. But if you break it all down and…

    Topaz George 6 August 2020
    44 Comments
    sccm-client-error-messages

    List of SCCM Client error messages

    Listed below are the SCCM Client error messages. This list was originally posted into Microsoft TechNet by Klaus Bilger. Click here to view the TechNet article.…

    Topaz George 10 July 2020
    1 Comment
    SMS-server-State-Messages-1

    SMS server state messages

    List of SMS server State Messages. This list was originally posted into Microsoft TechNet by Klaus Bilger. Click here to view the TechNet article. People who…

    Topaz George 8 July 2020
    0 Comments
    SMS provider State Messages

    SMS provider State Messages

    List of SMS provider State Messages. This list was originally posted into Microsoft TechNet by Klaus Bilger. Click here to view the TechNet article. People who viewed…

    Topaz George 7 July 2020
    0 Comments
    Problem Steps Recorder

    Steps Recorder (PSR) : Documentation made easy

    Problem Steps Recorder (Not just for problems) is a windows in-built tool to capture step by step actions and screenshots to reproduce a problem or…

    Topaz George 6 July 2020
    0 Comments
    SCCM application persona and profile

    SCCM OS deployment | Application profiles | Windows 10 upgrades.

    Enterprise Windows upgrades for desktops, laptops and tablets are time consuming and expensive. But all upgrades follow a similar pattern wherein the following processes are…

    Topaz George 5 July 2020
    0 Comments
    SCCM Client State Messages

    SCCM Client State Messages

    List of SCCM Client State Messages. This list was originally posted into Microsoft TechNet by Klaus Bilger. Click here to view the TechNet article. People who viewed…

    Topaz George 3 July 2020
    0 Comments
    Covid19 Sensor iPhone android

    Covid19 Sensor – iPhone and Android

    COVID -19 sensor feature has been added for most iPhones and Google Android. Is this good or bad? Share your thoughts below. If you have…

    Topaz George 28 June 2020
    2 Comments
    SCCM-Advertisment-State-Messages-1

    SCCM Advertisement State Messages

    List of SCCM Advertisement State Messages. This list was originally posted into Microsoft TechNet by Klaus Bilger. Click here to view the TechNet article.

    Topaz George 28 June 2020
    0 Comments
    Network Drive Inventory Report using SCCM

    SCCM Network drives inventory. List all user network mapped drives

    Topaz George 5 May 2020
    3 Comments
    Load More

    © 2023 - osd365 limited

    Forum Description

    SCCM HW inventory agent runs as the ‘SYSTEM’ and cannot see the end-users network drives and printers. This post explains the process of creating an SCCM network drive report.

     

    The following two-step process will help circumvent the above-stated limitation.

    1) CREATE HKEY_LOCAL_MACHINE\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES PATH IN THE REGISTRY.

    • Create an SCCM package.
    • The package should run as an administrator.
    • The package should run whether or not a user is logged on.

    keywords in this post: network drive inventory, List all user network drives, SCCM Mapped drives

    POWERSHELL PACKAGE 1 (Prerequisite):

    if (!(Test-Path HKLM:\SOFTWARE\SCCMINVENTORY)) {new-item HKLM:\SOFTWARE\SCCMINVENTORY  -ErrorAction SilentlyContinue} 
    $perm = get-acl HKLM:\SOFTWARE\SCCMINVENTORY  -ErrorAction SilentlyContinue 
    $rule = New-Object System.Security.AccessControl.RegistryAccessRule("Authenticated Users","FullControl", "ContainerInherit, ObjectInherit", "InheritOnly", "Allow")  -ErrorAction SilentlyContinue 
    $perm.SetAccessRule($rule) 
    Set-Acl -Path HKLM:\SOFTWARE\SCCMINVENTORY $perm  -ErrorAction SilentlyContinue 
    if (!(Test-Path HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES)) {new-item HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES -ErrorAction SilentlyContinue}
    • SAVE POWERSHELL FILE AS: NetworkDriveInvRegSetup.ps1
    • SETUP THE SCCM PACKAGE/PROGRAM WITH COMMAND LINE:
    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\PowerShell.exe -NonInteractive -WindowStyle Hidden -noprofile -ExecutionPolicy Bypass -file .\NetworkDriveInvRegSetup.ps1

    2) CAPTURE CURRENT USER’S NETWORK DRIVES AND WRITE THOSE ENTRIES TO THE ABOVE CREATED REGISTRY KEYS.

    • Create an SCCM package
    • The package should be run only when a user is logged in.

     POWERSHELL PACKAGE 2 (Main):

    $nDrives = Get-WmiObject Win32_MappedLogicalDisk | select ProviderName,size,freeSpace,
    @{Name="driveLetter";Expression={$_.Name}},
    @{Name="path";Expression={$_.ProviderName}},
    @{Name="serverName";Expression={$($_.ProviderName).Split("\")[2]}},
    @{Name="shareName";Expression={$($_.ProviderName.TrimEnd("\")).Split("\")[-1]}} 
    ForEach($nDrive in $nDrives){ 
        $nServerName= $nDrive.serverName
        $nShareName = $nDrive.shareName 
        $nDriveLetter = $nDrive.driveLetter 
    
        if ((Test-Path HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES)) { 
            if ((Test-Path "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES\$nShareName on $nServerName")) { 
                Remove-item "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES\$nShareName on $nServerName" -Force -ErrorAction SilentlyContinue 
            } 
            New-item "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES\$nShareName on $nServerName" -ErrorAction SilentlyContinue 
            New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES\$nShareName on $nServerName" -Name "servername" -Value $nServerName -PropertyType "String" -ErrorAction SilentlyContinue 
            New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES\$nShareName on $nServerName" -Name "sharename" -Value $nShareName -PropertyType "String" -ErrorAction SilentlyContinue 
            New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES\$nShareName on $nServerName" -Name "driveletter" -Value $nDriveLetter -PropertyType "String" -ErrorAction SilentlyContinue  
            New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKDRIVES\$nShareName on $nServerName" -Name "dateinventoried" -Value $(get-date -Format "dd/MM/yyyy") -PropertyType "String" -ErrorAction SilentlyContinue 
        } 
    } 
    
    • SAVE POWERSHELL FILE AS NetworkDriveInventory.ps1
    • SETUP THE SCCM PACKAGE/PROGRAM WITH COMMAND LINE:
    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\PowerShell.exe -NonInteractive -WindowStyle Hidden -noprofile -ExecutionPolicy Bypass -file .\NetworkDriveInventory.ps1

    3) CREATE A DEPLOYMENT AND SET IT TO ‘RUN ALWAYS’ AND MAKE IT A REQUIREMENT.

    • Now deploy the second package and set the first package as a prerequisite (Check the box – Always run the prerequisite package)
    • The deployment should be set to run every 4 hours and ‘Always rerun’. Mark the deployment as required.

    4) ADD THE FOLLOWING IN BETWEEN THE EXTENSION SECTION WITHIN YOUR CONFIGURATION.MOF.

    Click here to learn how to edit the configuration.mof file.

    //========================
    // Added extensions Start
    //========================
    
    #pragma namespace ("\\\\.\\root\\cimv2")
    #pragma deleteclass("NETWORKDRIVES", NOFAIL)
    [dynamic, provider("RegProv"), ClassContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\SCCMINVENTORY\\NETWORKDRIVES")]
    Class NETWORKDRIVES
    {
    [key] string KeyName;
    [PropertyContext("servername")] String servername;
    [PropertyContext("sharename")] String sharename;
    [PropertyContext("driveletter")] String driveletter;
    [PropertyContext("dateinventoried")] String dateinventoried;
    };
    
    //========================
    // Added extensions end
    //======================== 
    

    5) SAVE THE BELOW DATA INTO A FILE CALLED ‘AWESOME.MOF’. (Optional)

    #pragma namespace (“\\\\.\\root\\cimv2\\SMS”)
    #pragma deleteclass(“NETWORKDRIVES”, NOFAIL)
    [SMS_Report(TRUE),SMS_Group_Name("NETWORKDRIVES"),SMS_Class_ID("NETWORKDRIVES")]
    Class NETWORKDRIVES: SMS_Class_Template
    {
    [SMS_Report(TRUE),key] string KeyName;
    [SMS_Report(TRUE)] String servername;
    [SMS_Report(TRUE)] String sharename;
    [SMS_Report(TRUE)] String driveletter;
    [SMS_Report(TRUE)] String dateinventoried;
    };

    6) IMPORT ‘AWESOME.MOF’ INTO SCCM DEFAULT CLIENT SETTINGS.

    • Either import the above MOF file into the Client Setting/Default Client Settings/Hardware Inventory/Classes/Import. Select the option to import everything.
    • Alternatively, if you have compiled the MOF manually on the PC, Add a new reporting class by clicking the ‘Add’ button and connecting to the PC and selecting the WMI class ‘NETWORKDRIVES‘
      and that is it. The SCCM resource explorer should soon see the Network drives.
    • You can then use the ‘NETWORKDRIVES‘ class to generate reports or create Queries.

    keywords in this post: network drive inventory, List all user network drives, SCCM Mapped drives

    Click here to learn more about network printer inventory.