Skip to content

8ugMak1r/go-wmic

Repository files navigation

WMIC Package

The GO Version WMIC (Windows Management Instrumentation Command-line) package provides an interface for accessing Windows system hardware and software information.

Features

  • Disk drive information query
  • Disk partition management
  • Logical disk operations
  • Operating system information retrieval
  • Volume management
  • NFS client functionality detection

Installation

Prerequisites

  • Go 1.20 or later
  • Windows operating system

Install from source

git clone https://github.com/8ugMak1r/go-wmic.git
cd go-wmic/cmd
go build -o go-wmic.exe 

Main Components

1. Disk Drive (Win32_DiskDrive)

  • List all disk drives
  • Query disk drive by device ID
  • Get operating system disk drive

2. Disk Partition (Win32_DiskPartition)

  • List all disk partitions
  • Query partition information by device ID
  • Query partitions by disk index

3. Logical Disk (Win32_LogicalDisk)

  • List all logical disks
  • List NFS logical disks
  • Query logical disk by drive letter

4. Operating System Information (Win32_OperatingSystem)

  • Get detailed operating system information

5. Volume Management (Win32_Volume)

  • List all volumes
  • Query volume by drive letter
  • Get system reserved volumes

6. Additional Features (Win32_OptionalFeature)

  • Check NFS client feature availability

Command Line Tool Usage

Basic Usage

go-wmic.exe [command] [options]

Command List

1. Disk Drive Information

# List all disk drives
go-wmic.exe disk-drive

# List all disk drives in JSON format
go-wmic.exe disk-drive --json

2. Disk Partition Information

# List all disk partitions
go-wmic.exe disk-partition

# List all disk partitions in JSON format
go-wmic.exe disk-partition --json

3. Logical Disk Information

# List all logical disks
go-wmic.exe logical-disk

# List all logical disks in JSON format
go-wmic.exe logical-disk --json

4. Operating System Information

# Get operating system information
go-wmic.exe os-info

# Get operating system information in JSON format
go-wmic.exe os-info --json

5. Volume Management

# List all volumes
go-wmic.exe volume

# List all volumes in JSON format
go-wmic.exe volume --json

Global Options

--help, -h    Show help information
--json, -j    Output in JSON format

Usage Examples

Get Disk Drive Information

diskDrives, err := ListWin32DiskDrives()
if err != nil {
    log.Fatal(err)
}

Get Logical Disk Information

logicalDisks, err := ListWin32LogicalDisk()
if err != nil {
    log.Fatal(err)
}

Get Operating System Information

osInfo, err := GetWin32OperatingSystem()
if err != nil {
    log.Fatal(err)
}

Check NFS Client Feature

nfsEnabled, err := NfsClientAble()
if err != nil {
    log.Fatal(err)
}

Dependencies

  • github.com/yusufpapurcu/wmi
  • github.com/pkg/errors

Notes

  • This package only supports Windows systems
  • Administrator privileges are required to access certain system information
  • Some features may vary depending on the system version

Directory Structure

wmic/
├── examples/                       # Example returns
├── cmd/                            # Main program
├── model.go                        # Data model definitions
├── win32_disk_drive.go             # Disk drive related functions
├── win32_disk_partition.go         # Disk partition related functions
├── win32_logical_disk.go           # Logical disk related functions
├── win32_mapped_logical_disk.go    # Mapped logical disk related functions
├── win32_operating_system.go       # Operating system information related functions
├── win32_optional_feature.go       # Optional feature related functions
├── win32_volume.go                 # Volume management related functions
└── wmic.go                         

License

MIT License

Copyright (c) 2024 8ugMak1r

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors