1

Installing WMIC on Ubuntu 16.04

Posted by simon on 2017-07-17 in Guides |

Step 1 – Install building applications

sudo apt-get install autoconf make gcc libdatetime-perl build-essential g++ python-dev

Step 2 – Download the ‘wmic’ source

cd ~
wget http://www.opsview.com/sites/default/files/wmi-1.3.16.tar_.bz2

Step 3 – Untar the source

tar -xvf wmi-1.3.16.tar_.bz2

Step 4 – Go into the directory

cd wmi-1.3.16

Step 5 – Edit Samba/source/pidl/pidl and remove Line 583

nano Samba/source/pidl/pidl
remove Line 583 (not sure how to do it short hand)

Step 6 – Compile and grab a butty as will take a few minutes

sudo sh -c "ulimit -n 100000 && export ZENHOME=/usr && make \"CPP=gcc -E -ffreestanding\" "

Step 7 – Move binary into /bin

sudo cp Samba/source/bin/wmic /bin

Step 8 – Test wmic

#Test it 
wmic --workgroup=DOMAIN --user=USER --password=PASSWORD //SERVER.DOMAIN.COM "SELECT * FROM Win32_ComputerSystem"

#Output should be similar to this:
CLASS: Win32_OperatingSystem
BootDevice|BuildNumber|BuildType|Caption|CodeSet|CountryCode|CreationClassName|CSCreationClassName|CSDVersion|CSName|CurrentTimeZone|Debug|Description|Distributed|EncryptionLevel|ForegroundApplicationBoost|FreePhysicalMemory|FreeSpaceInPagingFiles|FreeVirtualMemory|InstallDate|LargeSystemCache|LastBootUpTime|LocalDateTime|Locale|Manufacturer|MaxNumberOfProcesses|MaxProcessMemorySize|Name|NumberOfLicensedUsers|NumberOfProcesses|NumberOfUsers|Organization|OSLanguage|OSProductSuite|OSType|OtherTypeDescription|PAEEnabled|PlusProductID|PlusVersionNumber|Primary|ProductType|QuantumLength|QuantumType|RegisteredUser|SerialNumber|ServicePackMajorVersion|ServicePackMinorVersion|SizeStoredInPagingFiles|Status|SuiteMask|SystemDevice|SystemDirectory|SystemDrive|TotalSwapSpaceSize|TotalVirtualMemorySize|TotalVisibleMemorySize|Version|WindowsDirectory
\Device\HarddiskVolume1|3790|Uniprocessor Free|Microsoft(R) Windows(R) Server 2003, Enterprise Edition|1252|1|Win32_OperatingSystem|Win32_ComputerSystem||WIN2003-VM-HS|120|False||False|168|2|779280|2348260|3127540|20121101081525.000000+120|1|20121101090258.411875+120|20121105103817.505000+120|0409|Microsoft Corporation|4294967295|2097024|Microsoft Windows Server 2003 Enterprise Edition|C:\WINDOWS|\Device\Harddisk0\Partition1|5|46|4|Sintrex Integration Services (Pty) Ltd|1033|274|18|(null)|False|(null)|(null)|True|3|0|0|Test User|69763-011-6394922-43753|0|0|2527020|OK|274|\Device\HarddiskVolume1|C:\WINDOWS\system32|C:|0|3575072|1048052|5.2.3790|C:\WINDOWS

That’s it, it should work now from anywhere

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © 2014-2021 Simon Smith All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.