{"id":208088,"date":"2023-06-14T18:42:46","date_gmt":"2023-06-14T18:42:46","guid":{"rendered":"https:\/\/www.ninjaone.com\/script-hub\/come-verificare-monitorare-spaziodisco-script-powershell\/"},"modified":"2024-03-04T16:01:26","modified_gmt":"2024-03-04T16:01:26","slug":"come-verificare-monitorare-spaziodisco-script-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/it\/script-hub\/come-verificare-monitorare-spaziodisco-script-powershell\/","title":{"rendered":"Come verificare e monitorare lo spazio su disco con lo script PowerShell"},"content":{"rendered":"<p>Il <strong>monitoraggio dello spazio su disco<\/strong> \u00e8 una componente di base, ma allo stesso tempo fondamentale, dell&#8217;assistenza IT proattiva, essenziale per ridurre il volume dei ticket e mantenere l\u2019integrit\u00e0 e la stabilit\u00e0 del sistema. La mancanza o l&#8217;esaurimento dello spazio su disco pu\u00f2 ovviamente essere responsabile di una serie di problemi e lamentele da parte degli utenti, dai malfunzionamenti delle applicazioni ai completi arresti anomali del sistema, per cui la creazione di avvisi quando le unit\u00e0 scendono al di sotto di una determinata soglia \u00e8 un ottimo modo per evitarli. Questo post ti illustrer\u00e0 in che modo verificare la capacit\u00e0 del disco e avvisare in caso di spazio ridotto, da remoto, su tutta la tua base di utenti. Come si pu\u00f2 verificare lo spazio del disco rigido da remoto e inviare un avviso quando lo spazio \u00e8 ridotto?<\/p>\n<ol>\n<li>Identifica le unit\u00e0 che intendi monitorare e quelle che (eventualmente) desideri escludere.<\/li>\n<li>Determina le soglie di spazio su disco che desideri impostare per ciascun tipo di unit\u00e0.<\/li>\n<li>Personalizza di conseguenza lo script sottostante.<\/li>\n<\/ol>\n<p>Questo script PowerShell \u00e8 stato progettato per segnalare le unit\u00e0 che scendono al di sotto di una percentuale o di un parametro specificato. Tale script fa la distinzione tra unit\u00e0 di sistema (quelle utilizzate per avviare il sistema operativo) e unit\u00e0 di dati, fornendo una panoramica completa dell&#8217;utilizzo dello spazio su disco. Lo script \u00e8 versatile e personalizzabile e consente di impostare i parametri per le unit\u00e0 di sistema e di dati separatamente. \u00c8 possibile specificare lo spazio libero minimo sia in percentuale che in byte e persino escludere alcune unit\u00e0 dalla verifica. Questa flessibilit\u00e0 \u00e8 ideale per qualsiasi <a href=\"https:\/\/www.ninjaone.com\/it\/blog\/best-practices-help-desk-it\/\">professionista IT<\/a> o <a href=\"https:\/\/www.ninjaone.com\/it\/cos-e-un-msp\/\">MSP<\/a>.<\/p>\n<h2>Lo script Disk Space Monitor:<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-group=\"require-terms\">#Requires -Version 2.0\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Alert on drive(s) that fall below a specified % or size. Distinguishes between System and Data drives.\r\n.DESCRIPTION\r\n    Alert on drive(s) that fall below a specified % or size. Distinguishes between System and Data drives.\r\n    The system drive is the drive(s) that are used to boot the OS.\r\n.EXAMPLE\r\n     -SystemDriveMinFreePercent 10 -SystemDriveMinFreeBytes 10GB -DataDriveMinFreePercent 20 -DataDriveMinFreeBytes 20GB\r\n    This checks all Drives\r\n.EXAMPLE\r\n     -ExcludeDrivesCustomField \"C,Z\" -SystemDriveMinFreePercentCustomField \"SystemDriveMinFreePercent\" -SystemDriveMinFreeBytes \"SystemDriveMinFreeBytes\" -DataDriveMinFreePercent \"DataDriveMinFreePercent\" -DataDriveMinFreeBytes \"DataDriveMinFreeBytes\"\r\n    This checks all Drives, except for C: and Z:.\r\n    Use this if you wish to to custom fields to specify the values from roles or globally.\r\n    This will pull the values from custom fields that would have otherwise been used from parameters.\r\n.EXAMPLE\r\n     -ExcludeDrivesByNameCustomField \"NoMonitor\" -SystemDriveMinFreePercentCustomField \"SystemDriveMinFreePercent\" -SystemDriveMinFreeBytes \"SystemDriveMinFreeBytes\" -DataDriveMinFreePercent \"DataDriveMinFreePercent\" -DataDriveMinFreeBytes \"DataDriveMinFreeBytes\"\r\n    This checks all Drives, except where a drive name\/label contains the text \"NoMonitor\".\r\n    Use this if you wish to to custom fields to specify the values from roles or globally.\r\n    This will pull the values from custom fields that would have otherwise been used from parameters.\r\n.EXAMPLE\r\n     No Parameters Specified\r\n    This checks all Drives with the defaults:\r\n        SystemDriveMinFreePercent   10%\r\n        SystemDriveMinFreeBytes     10GB\r\n        DataDriveMinFreePercent 20%\r\n        DataDriveMinFreeBytes   20GB\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 7, Windows Server 2012 R2\r\n    Release Notes:\r\n    Initial Release\r\n    (c) 2023 NinjaOne\r\n    By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/it\/condizioni-utilizzo\/\r\n    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n    Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [String]\r\n    $ExcludeDrives,\r\n    $ExcludeDrivesCustomField, # If set, get value from a custom field with this name.\r\n    [String]\r\n    $ExcludeDrivesByName,\r\n    $ExcludeDrivesByNameCustomField, # If set, get value from a custom field with this name.\r\n    $SystemDriveMinFreePercent = 10,\r\n    $SystemDriveMinFreePercentCustomField, # If set, get value from a custom field with this name.\r\n    $SystemDriveMinFreeBytes = 10GB,\r\n    $SystemDriveMinFreeBytesCustomField, # If set, get value from a custom field with this name.\r\n    $DataDriveMinFreePercent = 20,\r\n    $DataDriveMinFreePercentCustomField, # If set, get value from a custom field with this name.\r\n    $DataDriveMinFreeBytes = 20GB,\r\n    $DataDriveMinFreeBytesCustomField # If set, get value from a custom field with this name.\r\n)\r\n\r\nbegin {\r\n    function Get-Size {\r\n        param (\r\n            [string]$String\r\n        )\r\n        switch -wildcard ($String) {\r\n            '*PB' { [int64]$($String -replace '[^d+]+') * 1PB; break }\r\n            '*TB' { [int64]$($String -replace '[^d+]+') * 1TB; break }\r\n            '*GB' { [int64]$($String -replace '[^d+]+') * 1GB; break }\r\n            '*MB' { [int64]$($String -replace '[^d+]+') * 1MB; break }\r\n            '*KB' { [int64]$($String -replace '[^d+]+') * 1KB; break }\r\n            '*B' { [int64]$($String -replace '[^d+]+') * 1; break }\r\n            '*Bytes' { [int64]$($String -replace '[^d+]+') * 1; break }\r\n            Default { [int64]$($String -replace '[^d+]+') * 1 }\r\n        }\r\n    }\r\n    function Get-FriendlySize {\r\n        param($Bytes)\r\n        # Converts Bytes to the highest matching unit\r\n        $Sizes = 'Bytes,KB,MB,GB,TB,PB,EB,ZB' -split ','\r\n        for ($i = 0; ($Bytes -ge 1kb) -and ($i -lt $Sizes.Count); $i++) { $Bytes \/= 1kb }\r\n        $N = 2\r\n        if ($i -eq 0) { $N = 0 }\r\n        if ($Bytes) { \"$([System.Math]::Round($Bytes,$N)) $($Sizes[$i])\" }else { \"0 B\" }\r\n    }\r\n    function Invoke-DiskAlert {\r\n        param (\r\n            [PSObject[]]$Drives\r\n        )\r\n        $Drives | ForEach-Object {\r\n            $Type = if ($_.IsSystemDrive) { \"SystemDrive\" }else { \"DataDrive\" }\r\n            $Drive = $_\r\n            if ($Drive.totalSpace -and $Drive.freeSpace \/ $Drive.totalSpace * 100 -lt $Settings.\"$Type\".MinFreePercent) {\r\n                Write-Output \"$Type ($($Drive.driveName)) free space is under $($Settings.\"$Type\".MinFreePercent)% at $(Get-FriendlySize -Bytes $Drive.freeSpace)\"\r\n            }\r\n            elseif ($Drive.freeSpace -lt $Settings.$Type.MinFreeBytes) {\r\n                Write-Output \"$Type ($($Drive.driveName)) free space is under $(Get-FriendlySize -Bytes $Settings.\"$Type\".MinFreeBytes) at $(Get-FriendlySize -Bytes $Drive.freeSpace)\"\r\n            }\r\n        }\r\n    }\r\n    function Get-Drive {\r\n        param([string]$DriveName)\r\n        if ($(Get-Command -Name \"Get-CimInstance\")) {\r\n            Get-CimInstance -Query \"select * from Win32_DiskDrive\" | Where-Object { $_.Size } | ForEach-Object {\r\n                $d = $_\r\n                $d | ForEach-Object {\r\n                    $Disk = $_\r\n                    $p = Get-CimInstance -Query \"ASSOCIATORS OF {Win32_DiskDrive.DeviceID='$($Disk.DeviceID)'}  WHERE AssocClass = Win32_DiskDriveToDiskPartition\"\r\n                    $p | ForEach-Object {\r\n                        $Partition = $_\r\n                        Get-CimInstance -Query \"ASSOCIATORS OF {Win32_DiskPartition.DeviceID='$($Partition.DeviceID)'} WHERE AssocClass = Win32_LogicalDiskToPartition\" | ForEach-Object {\r\n                            $ld = $_\r\n                            [PSCustomObject]@{\r\n                                driveName     = $ld.DeviceId # C:\r\n                                IsSystemDrive = if ($p | Where-Object { $_.BootPartition }) { $true }else { $false }\r\n                                freeSpace     = $ld.FreeSpace # in bytes\r\n                                totalSpace    = $ld.Size # in bytes\r\n                                fileSystem    = $ld.FileSystem # NTFS\r\n                                physicalName  = $d.Name # \\.PHYSICALDRIVE2\r\n                                diskName      = $d.Caption # WDC WD5001AALS-xxxxxx\r\n                                diskModel     = $d.Model # WDC WD5001AALS-xxxxxx\r\n                                diskInterface = $d.InterfaceType # IDE\r\n                                mediaStatus   = $d.Status # OK\r\n                                volumeName    = $ld.VolumeName # System\r\n                                volumeSerial  = $ld.VolumeSerialNumber # 12345678\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        else {\r\n            Get-WmiObject -Query \"select * from Win32_DiskDrive\" | Where-Object { $_.Size } | ForEach-Object {\r\n                $d = $_\r\n                $d | ForEach-Object {\r\n                    $Disk = $_\r\n                    $p = Get-WmiObject -Query \"ASSOCIATORS OF {Win32_DiskDrive.DeviceID='$($Disk.DeviceID)'}  WHERE AssocClass = Win32_DiskDriveToDiskPartition\"\r\n                    $p | ForEach-Object {\r\n                        $Partition = $_\r\n                        Get-WmiObject -Query \"ASSOCIATORS OF {Win32_DiskPartition.DeviceID='$($Partition.DeviceID)'} WHERE AssocClass = Win32_LogicalDiskToPartition\" | ForEach-Object {\r\n                            $ld = $_\r\n                            [PSCustomObject]@{\r\n                                driveName     = $ld.DeviceId # C:\r\n                                IsSystemDrive = if ($p | Where-Object { $_.BootPartition }) { $true }else { $false }\r\n                                freeSpace     = $ld.FreeSpace # in bytes\r\n                                totalSpace    = $ld.Size # in bytes\r\n                                fileSystem    = $ld.FileSystem # NTFS\r\n                                physicalName  = $d.Name # \\.PHYSICALDRIVE2\r\n                                diskName      = $d.Caption # WDC WD5001AALS-xxxxxx\r\n                                diskModel     = $d.Model # WDC WD5001AALS-xxxxxx\r\n                                diskInterface = $d.InterfaceType # IDE\r\n                                mediaStatus   = $d.Status # OK\r\n                                volumeName    = $ld.VolumeName # System\r\n                                volumeSerial  = $ld.VolumeSerialNumber # 12345678\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\nprocess {\r\n    # Get values from parameters\r\n    $Settings = [PSCustomObject]@{\r\n        SystemDrive = [PSCustomObject]@{\r\n            MinFreePercent = if ($env:SystemDriveMinFreePercent) { $env:SystemDriveMinFreePercent -replace '%' }else { $SystemDriveMinFreePercent }\r\n            MinFreeBytes   = if ($env:SystemDriveMinFreeBytes) { Get-Size -Size $env:SystemDriveMinFreeBytes }else { $SystemDriveMinFreeBytes }\r\n        }\r\n        DataDrive   = [PSCustomObject]@{\r\n            MinFreePercent = if ($env:DataDriveMinFreePercent) { $env:DataDriveMinFreePercent -replace '%' }else { $DataDriveMinFreePercent }\r\n            MinFreeBytes   = if ($env:DataDriveMinFreeBytes) { Get-Size -Size $env:DataDriveMinFreeBytes }else { $DataDriveMinFreeBytes }\r\n        }\r\n    }\r\n    # Get values from custom field\r\n    if ($SystemDriveMinFreePercentCustomField) {\r\n        $Settings.SystemDrive.MinFreePercent = Ninja-Property-Get -Name $SystemDriveMinFreePercentCustomField\r\n    }\r\n    if ($SystemDriveMinFreeBytesCustomField) {\r\n        $Settings.SystemDrive.MinFreeBytes = Ninja-Property-Get -Name $SystemDriveMinFreeBytesCustomField\r\n    }\r\n    if ($DataDriveMinFreePercentCustomField) {\r\n        $Settings.DataDrive.MinFreePercent = Ninja-Property-Get -Name $DataDriveMinFreePercentCustomField\r\n    }\r\n    if ($DataDriveMinFreeBytesCustomField) {\r\n        $Settings.DataDrive.MinFreeBytes = Ninja-Property-Get -Name $DataDriveMinFreeBytesCustomField\r\n    }\r\n    if ($env:ExcludeDrives) {\r\n        $ExcludeDrives = $env:ExcludeDrives\r\n    }\r\n    if ($ExcludeDrivesCustomField) {\r\n        $ExcludeDrives = Ninja-Property-Get -Name $ExcludeDrivesCustomField\r\n    }\r\n    if ($env:ExcludeDrivesByName) {\r\n        $ExcludeDrivesByName = $env:ExcludeDrivesByName\r\n    }\r\n    if ($env:ExcludeDrivesByNameCustomField) {\r\n        $ExcludeDrivesByNameCustomField = $env:ExcludeDrivesByNameCustomField\r\n    }\r\n\r\n    # System.IO.DriveInfo is usable as far back as .NET 2.0 for Windows 7 compatibility.\r\n    # Reference: https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.io.driveinfo?view=netstandard-2.0\r\n\r\n    # Get drives that are in the ready state\r\n    $Drives = Get-Drive\r\n\r\n    $Results = if ($Drives) {\r\n        $DrivesFiltered = if ($ExcludeDrivesByName) {\r\n            $Drives | Where-Object { $_.volumeName -notlike \"*$ExcludeDrivesByName*\" }\r\n        }\r\n        else { $Drive }\r\n\r\n        if ($ExcludeDrives) {\r\n            $DriveAlerts = Invoke-DiskAlert -Drives $DrivesFiltered\r\n            $DriveList = if ($ExcludeDrives -like \"*,*\") {\r\n                $ExcludeDrives -split ',' | Sort-Object -Unique\r\n            }\r\n            else {\r\n                $ExcludeDrives -split '' | Sort-Object -Unique | Select-Object -Skip 1\r\n            }\r\n            $DriveList | ForEach-Object {\r\n                $Drive = $_\r\n                $DriveAlerts | Where-Object { $_ -notlike \"*$($Drive):*\" }\r\n            }\r\n            \r\n        }\r\n        else {\r\n            Invoke-DiskAlert -Drives $Drives $DrivesFiltered\r\n        }\r\n    }\r\n    else {\r\n        # Should never get here, how was the script executed?!\r\n        \"No drives found?!\" | Out-String | Write-Host\r\n        exit 2\r\n    }\r\n\r\n    if ($Results) {\r\n        $Results | Out-String | Write-Host\r\n        exit 1\r\n    }\r\n    else {\r\n        Write-Host \"No drives found with low free space.\"\r\n        exit 0\r\n    }\r\n}\r\nend {\r\n    $ScriptVariables = @(\r\n        [PSCustomObject]@{\r\n            name           = \"Exclude Drives\"\r\n            calculatedName = \"excludedrives\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"List if mounted drives to exclude from low drive check. Example: CFZ or C,F,Z\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"Exclude Drives Custom Field\"\r\n            calculatedName = \"excludedrivescustomfield\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"A custom field to get the value from. List if mounted drives to exclude from low drive check. Example: CFZ or C,F,Z\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"Exclude Drives By Name\"\r\n            calculatedName = \"excludedrivesbyname\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"Exclude drives with with the specified text in it's name\/label.\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"Exclude Drives By Name Custom Field\"\r\n            calculatedName = \"excludedrivesbynamecustomfield\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"A custom field to get the value from. Exclude drives with with the specified text in it's name\/label.\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"System Drive Minimum Size in Percent\"\r\n            calculatedName = \"systemdriveminfreepercent\"\r\n            required       = $false\r\n            defaultValue   = [PSCustomObject]@{\r\n                type  = \"TEXT\"\r\n                value = \"10%\"\r\n            }\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"The percentage of free space to alert on when the OS drive is below this percentage. Example: 50 or 50%\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"System Drive Minimum Size in Bytes\"\r\n            calculatedName = \"systemdriveminfreebytes\"\r\n            required       = $false\r\n            defaultValue   = [PSCustomObject]@{\r\n                type  = \"TEXT\"\r\n                value = \"10GB\"\r\n            }\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"The minimum free space to alert on when the OS drive is below this amount. Example: 50GB, 50000MB, or 53687091200\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"Data Drive Minimum Size in Percent\"\r\n            calculatedName = \"datadriveminfreepercent\"\r\n            required       = $false\r\n            defaultValue   = [PSCustomObject]@{\r\n                type  = \"TEXT\"\r\n                value = \"20%\"\r\n            }\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"The percentage of free space to alert on when a Data drive is below this percentage. Example: 50 or 50%\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"Data Drive Minimum Size in Bytes\"\r\n            calculatedName = \"datadriveminfreebytes\"\r\n            required       = $false\r\n            defaultValue   = [PSCustomObject]@{\r\n                type  = \"TEXT\"\r\n                value = \"20GB\"\r\n            }\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"The minimum free space to alert on when the Data drive is below this amount. Example: 50GB, 50000MB, or 53687091200\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"System Drive Minimum Size in Percent Custom Field\"\r\n            calculatedName = \"systemdriveminfreepercentcustomfield\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"A custom field to get the value from. The percentage of free space to alert on when the OS drive is below this percentage. Example: 50 or 50%\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"System Drive Minimum Size in Bytes Custom Field\"\r\n            calculatedName = \"systemdriveminfreebytescustomfield\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"A custom field to get the value from. The minimum free space to alert on when the OS drive is below this amount. Example: 50GB, 50000MB, or 53687091200\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"Data Drive Minimum Size in Percent Custom Field\"\r\n            calculatedName = \"datadriveminfreepercentscustomfield\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"A custom field to get the value from. The percentage of free space to alert on when a Data drive is below this percentage. Example: 50 or 50%\"\r\n        }\r\n        [PSCustomObject]@{\r\n            name           = \"Data Drive Minimum Size in Bytes Custom Field\"\r\n            calculatedName = \"datadriveminfreebytescustomfield\"\r\n            required       = $false\r\n            defaultValue   = $null\r\n            valueType      = \"TEXT\"\r\n            valueList      = $null\r\n            description    = \"A custom field to get the value from. The minimum free space to alert on when the Data drive is below this amount. Example: 50GB, 50000MB, or 53687091200\"\r\n        }\r\n    )\r\n    $ScriptName = \"Condition Low Disk Space Alert\"\r\n}<\/pre>\n\n<div class=\"in-context-cta\"><p>Accedi a oltre 700 script nel Dojo di NinjaOne <a href=\"https:\/\/app.ninjarmm.com\/auth\/?return_to=https%3A%2F%2Fninjarmm.zendesk.com%2Fhc%2Fen-us%2Fsections%2F360012866471-Script-Share#\/register\" target=\"_blank\" rel=\"noopener\">Ottieni l&#8217;accesso<\/a><\/p>\n<\/div>\n<h2>Come funziona lo script Disk Space Monitor<\/h2>\n<p>Lo script funziona raccogliendo innanzitutto informazioni su tutte le unit\u00e0 del sistema. Questo script filtra quindi le unit\u00e0 che hai scelto di escludere e verifica le unit\u00e0 rimanenti in base ai parametri impostati. Se un&#8217;unit\u00e0 scende al di sotto dello spazio libero minimo specificato, lo script ti mander\u00e0 un avviso, dando la possibilit\u00e0 di intervenire prima che diventi un problema. Una delle caratteristiche principali di questo script \u00e8 la capacit\u00e0 di estrarre i valori dai campi personalizzati. Ci\u00f2 significa che \u00e8 possibile specificare i valori a livello globale o dai ruoli, aggiungendo un ulteriore livello di personalizzazione allo script.<\/p>\n<h2>Trasformare la gestione IT con NinjaOne<\/h2>\n<p>Sebbene sia possibile monitorare lo spazio su disco utilizzando rigorosamente PowerShell da un computer locale, esiste un modo ancora migliore per gestire le risorse IT in remoto e su larga scala: NinjaOne. NinjaOne \u00e8 una <a href=\"https:\/\/www.ninjaone.com\/it\/operazioni-it-unificate\/\">piattaforma di gestione unificata dell&#8217;IT<\/a> che incorpora le fasi di risoluzione, utilizzando se necessario degli script, nelle policy del dispositivo altamente flessibili, che determinano quando vengono raggiunte le soglie di allarme e le azioni successive da intraprendere. NinjaOne offre l&#8217;accesso a centinaia di script che possono essere utili, inclusa la possibilit\u00e0 di crearne di propri in quasi tutti i linguaggi di scripting. NinjaOne pu\u00f2 aiutarti a <a href=\"https:\/\/www.ninjaone.com\/it\/gestione-endpoint\/\">monitorare e gestire tutti gli endpoint IT<\/a> su larga scala da un&#8217;unica dashboard. Grazie a policy e script, \u00e8 possibile automatizzare praticamente qualsiasi attivit\u00e0 di routine, dall&#8217;installazione di patch software alla generazione di report, risparmiando tempo e gestendo in modo proattivo i problemi prima che diventino tali.<\/p>\n","protected":false},"author":35,"featured_media":206564,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4275],"class_list":["post-208088","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/script_hub\/208088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/comments?post=208088"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/media\/206564"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/media?parent=208088"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/operating_system?post=208088"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/use_cases?post=208088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}