The GO Version WMIC (Windows Management Instrumentation Command-line) package provides an interface for accessing Windows system hardware and software information.
- Disk drive information query
- Disk partition management
- Logical disk operations
- Operating system information retrieval
- Volume management
- NFS client functionality detection
- Go 1.20 or later
- Windows operating system
git clone https://github.com/8ugMak1r/go-wmic.git
cd go-wmic/cmd
go build -o go-wmic.exe - List all disk drives
- Query disk drive by device ID
- Get operating system disk drive
- List all disk partitions
- Query partition information by device ID
- Query partitions by disk index
- List all logical disks
- List NFS logical disks
- Query logical disk by drive letter
- Get detailed operating system information
- List all volumes
- Query volume by drive letter
- Get system reserved volumes
- Check NFS client feature availability
go-wmic.exe [command] [options]# List all disk drives
go-wmic.exe disk-drive
# List all disk drives in JSON format
go-wmic.exe disk-drive --json# List all disk partitions
go-wmic.exe disk-partition
# List all disk partitions in JSON format
go-wmic.exe disk-partition --json# List all logical disks
go-wmic.exe logical-disk
# List all logical disks in JSON format
go-wmic.exe logical-disk --json# Get operating system information
go-wmic.exe os-info
# Get operating system information in JSON format
go-wmic.exe os-info --json# List all volumes
go-wmic.exe volume
# List all volumes in JSON format
go-wmic.exe volume --json--help, -h Show help information
--json, -j Output in JSON formatdiskDrives, err := ListWin32DiskDrives()
if err != nil {
log.Fatal(err)
}logicalDisks, err := ListWin32LogicalDisk()
if err != nil {
log.Fatal(err)
}osInfo, err := GetWin32OperatingSystem()
if err != nil {
log.Fatal(err)
}nfsEnabled, err := NfsClientAble()
if err != nil {
log.Fatal(err)
}- github.com/yusufpapurcu/wmi
- github.com/pkg/errors
- This package only supports Windows systems
- Administrator privileges are required to access certain system information
- Some features may vary depending on the system version
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
MIT License
Copyright (c) 2024 8ugMak1r