Network Adapter Details
Purpose
This solution is designed to collect active network adapter details from managed devices and automatically populate custom fields with key network configuration information, including DHCP status, IP address type (Static or Dynamic), and DNS server addresses. The collected data enables improved visibility, reporting, and device grouping based on network configuration, ensuring accurate monitoring and streamlined network management.
Associated Content
| Content | Type | Function |
|---|---|---|
| cPVAL DHCP Status | Custom Field | Displays whether DHCP is enabled or disabled on the active network adapter. |
| cPVAL DNS Server | Custom Field | Displays the DNS server address(es) configured on the active network adapter. |
| cPVAL IP Type | Custom Field | Displays whether the IP configuration type is DHCP (Dynamic) or Static on the active network adapter. |
| cPVAL Check Network Adapter Details | Custom Field | Displays all network adapter–related custom fields, including DHCP status, IP type, and DNS server address |
| Get - Network Adapter Details | Script | Identifies the first active network adapter that is up, has an IPv4 address, and a default gateway. Collects DHCP status, IP type (DHCP or Static), and DNS server addresses in a comma-separated format. |
| cPVAL Network Adapter Details | Group | Displays all network adapter–related custom fields, including DHCP status, IP type, and DNS server addresses. |
| Check Network Adapter Details - Workstations | Compound condition | This compound condition is used to facilitate the automated execution of the script to update the custom field on Windows workstations. It ensures the custom field is updated only on eligible systems. |
| Check Network Adapter Details - Servers | Compound condition | This compound condition is used to facilitate the automated execution of the script to update the custom field on Windows servers. It ensures the custom field is updated only on eligible systems. |
Implementation
Step 1
- Create the cPVAL Network Adapter Details group.
Step 2
- Create the cPVAL DHCP Status custom field.
- Create the cPVAL DNS Server custom field
- Create the cPVAL IP Type custom field
- Create the cPVAL Network Adapter Details custom field
Step 3
- Create the Get - Network Adapter Details automation.
Step 4
- Create the - Check Network Adapter Details - Workstations Compound condition
- Create the - Check Network Adapter Details - Servers Compound condition
FAQ
Q1. What is the purpose of the script?
A. The script collects network adapter details from a Windows machine and updates custom fields with the DHCP status, IP configuration type (DHCP or Static), and configured DNS server addresses.
Q2. Which network adapter does the script evaluate?
A. The script identifies the first active network adapter that:
- Is in an Up state
- Has an IPv4 address
- Has a default gateway (indicating internet connectivity)
Q3. How does the script determine whether DHCP is enabled?
A. It checks the NetIPv4Interface.Dhcp property of the active adapter and reports the status as Enabled or Disabled.
Q4. How is the IP type (Dynamic or Static) identified?
A. If DHCP is enabled, the IP type is reported as DHCP. If DHCP is disabled, the IP type is reported as Static.
Q5. How are DNS server addresses collected?
A. The script retrieves all IPv4 DNS server addresses configured on the active adapter and outputs them as a comma-separated list.
Q6. What happens if no active network adapter is found?
A. If no qualifying adapter is detected, the script safely returns:
- Unknown for DHCP status
- Unknown for IP type
- Not Configured for DNS servers
This prevents incorrect or empty data from being stored.
Q7. Which custom fields are updated by this script?
A. The script updates the following NinjaOne custom fields:
- cpvalDhcpStatus – DHCP Enabled/Disabled
- cpvalIpType – Dynamic or Static
- cpvalDnsServer – DNS server addresses (comma-separated)
Q8. Does this script require user interaction or login?
A. No. The script runs as System and does not require user login or interaction.
Q9. Is this script safe for compliance-sensitive environments?
A. Yes. The script is read-only in nature and does not modify network settings. It only collects configuration data and updates reporting fields.
Q10. What platforms are supported?
A. The script supports Windows systems across all architectures and is designed for automated execution via RMM tools.