Utiles consultas WMIC – Command Prompt

WMIC es una utilidad que permite interactuar con WMI desde un shell de command prompt compatible con WMI el cual permite acceder a todos los objetos y sus propiedades a por medio de command prompt el cual lo convierte en una consola de administración de sistemas avanzara (WMIC).

En Portal+Tips tenemos varios articulos en el cual se utiliza WMIC para obtener informacion de los equipos local y remoto por ejemplo:

Los mencionados en los artículos anteriores son algunos casos en el cual se pueden aplicar el cual la mayoría son de consulta de información, mas no es lo único para lo que lo podemos utilizar. por ejemplo podemos restringir que un usuario cambie su contraseña wmic useraccount where name=’NombreDeUsuario’ set passwordchangeable=false.

A continuación te dejamos una lista de los Alias y Opciones que podemos utilizar con WMIC.

Sintaxis WMIC

La sintaxis de WMIC puede llegar a ser bastante compleja dependiendo lo que deseemos obtener o generar con este.

WMIC [global_switches] [alias] [options] [format]

El siguiente ejemplo tiene la siguiente sintaxis

WMIC /node: 10.0.0.52 BIOS GET serialnumber

Donde:

[global_switches] = /node: 10.0.0.52 (Opcional)
[alias] = BIOS
[options] = GET serialnumber
[format] = Opcional

Mas información en la pagina oficial de Microsoft

Listado de Global Switches

Global_SwitchesDescripción
/NODEServers to operate against:
@filename
machine_id <,machine id list>
/FAILFASTFailFast mode:(timeout for connection to remote machine)
ON, OFF
/LOCALELanguage id.
(ms_409=US)
/OUTPUTMode for output redirection:
STDOUT, CLIPBOARD,
/APPENDMode for output redirection:
STDOUT, CLIPBOARD,
/RECORDLog all input commands and output:
/INTERACTIVEInteractive mode:(prompt before WMI schema changes)
ON, OFF
/USERUser for this session:
\
/PASSWORDPassword for session login.
/PRIVILEGESEnable or disable all privileges:
ENABLE, DISABLE
/NAMESPACEPath for the namespace the alias operates against.
/ROLEPath for the role containing the alias definitions.
/TRACEOutput debugging information to stderr.
ON, OFF
/IMPLEVELClient impersonation level:
Anonymous,Identify,Impersonate,Delegate
/AUTHLEVELClient authentication level:
Default,None,Connect,Call,Pkt,Pktintegrity,Pktprivacy
/AGGREGATEAggregate mode: (column titles)
ON, OFF

Listado de Alias

AliasOpciones
baseboardget Manufacturer, Model, Name, PartNumber, slotlayout, serialnumber, poweredon
biosget name, version, serialnumber
bootconfigget BootDirectory, Caption, TempDirectory, Lastdrive
cdromget Name, Drive, Volumename
computersystemget Name, domain, Manufacturer, Model, NumberofProcessors, PrimaryOwnerName,Username, Roles, totalphysicalmemory /format:list
cpuget Name, Caption, MaxClockSpeed, DeviceID, status
datafilewhere name=’c:\boot.ini’ get Archive, FileSize, FileType, InstallDate, Readable, Writeable, System, Version
dcomappget Name, AppID /format:list
desktopget Name, ScreenSaverExecutable, ScreenSaverActive, Wallpaper /format:list
desktopmonitorget screenheight, screenwidth
diskdriveget Name, Manufacturer, Model, InterfaceType, MediaLoaded, MediaType
diskquotaget User, Warninglimit, DiskSpaceUsed, QuotaVolume
environmentget Description, VariableValue
fsdirwhere name=’c:\windows’ get Archive, CreationDate, LastModified, Readable, Writeable, System, Hidden, Status
groupget Caption, InstallDate, LocalAccount, Domain, SID, Status
idecontrollerget Name, Manufacturer, DeviceID, Status
irqget Name, Status
jobget Name, Owner, DaysOfMonth, DaysOfWeek, ElapsedTime, JobStatus, StartTime, Status
loadorderget Name, DriverEnabled, GroupOrder, Status
logicaldiskget Name, Compressed, Description, DriveType, FileSystem, FreeSpace, SupportsDiskQuotas, VolumeDirty, VolumeName
memcacheget Name, BlockSize, Purpose, MaxCacheSize, Status
memlogicalget AvailableVirtualMemory, TotalPageFileSpace, TotalPhysicalMemory, TotalVirtualMemory
memorychipget BankLabel, Capacity, Caption, CreationClassName, DataWidth, Description, Devicelocator, FormFactor, HotSwappable, InstallDate, InterleaveDataDepth, InterleavePosition, Manufacturer, MemoryType, Model, Name, OtherIdentifyingInfo, PartNumber, PositionInRow, PoweredOn, Removable, Replaceable, SerialNumber, SKU, Speed, Status, Tag, TotalWidth, TypeDetail, Version
memphysicalget Manufacturer, Model, SerialNumber, MaxCapacity, MemoryDevices
netclientget Caption, Name, Manufacturer, Status
netloginget Name, Fullname, ScriptPath, Profile, UserID, NumberOfLogons, PasswordAge, LogonServer, HomeDirectory, PrimaryGroupID
netprotocolget Caption, Description, GuaranteesSequencing, SupportsBroadcasting, SupportsEncryption, Status
netuseget Caption, DisplayType, LocalName, Name, ProviderName, Status
nicget AdapterType, AutoSense, Name, Installed, MACAddress, PNPDeviceID,PowerManagementSupported, Speed, StatusInfo
nicconfigget MACAddress, DefaultIPGateway, IPAddress, IPSubnet, DNSHostName, DNSDomain
nicconfigget MACAddress, IPAddress, DHCPEnabled, DHCPLeaseExpires, DHCPLeaseObtained, DHCPServer
nicconfigget MACAddress, IPAddress, DNSHostName, DNSDomain, DNSDomainSuffixSearchOrder, DNSEnabledForWINSResolution, DNSServerSearchOrder
nicconfigget MACAddress, IPAddress, WINSPrimaryServer, WINSSecondaryServer, WINSEnableLMHostsLookup, WINSHostLookupFile
ntdomainget Caption, ClientSiteName, DomainControllerAddress, DomainControllerName, Roles, Status
nteventwhere (LogFile=’system’ and SourceName=’W32Time’) get Message, TimeGenerated
nteventwhere (LogFile=’system’ and SourceName=’W32Time’ and Message like ‘%timesource%’) get Message, TimeGenerated
nteventwhere (LogFile=’system’ and SourceName=’W32Time’ and EventCode!=’29’) get TimeGenerated, EventCode, Message
onboarddeviceget Description, DeviceType, Enabled, Status
osget Version, Caption, CountryCode, CSName, Description, InstallDate, SerialNumber, ServicePackMajorVersion, WindowsDirectory /format:list
osget CurrentTimeZone, FreePhysicalMemory, FreeVirtualMemory, LastBootUpTime, NumberofProcesses, NumberofUsers, Organization, RegisteredUser, Status
pagefileget Caption, CurrentUsage, Status, TempPageFile
pagefilesetget Name, InitialSize, MaximumSize
partitionget Caption, Size, PrimaryPartition, Status, Type
printerget DeviceID, DriverName, Hidden, Name, PortName, PowerManagementSupported, PrintJobDataType, VerticalResolution, Horizontalresolution
printjobget Description, Document, ElapsedTime, HostPrintQueue, JobID, JobStatus, Name, Notify, Owner, TimeSubmitted, TotalPages
processget Caption, CommandLine, Handle, HandleCount, PageFaults, PageFileUsage, PArentProcessId, ProcessId, ThreadCount
productget Description, InstallDate, Name, Vendor, Version
qfeget description, FixComments, HotFixID, InstalledBy, InstalledOn, ServicePackInEffect
quotasettingget Caption, DefaultLimit, Description, DefaultWarningLimit, SettingID, State
recoverosget AutoReboot, DebugFilePath, WriteDebugInfo, WriteToSystemLog
Registryget CurrentSize, MaximumSize, ProposedSize, Status
scsicontrollerget Caption, DeviceID, Manufacturer, PNPDeviceID
serverget ErrorsAccessPermissions, ErrorsGrantedAccess, ErrorsLogon, ErrorsSystem, FilesOpen, FileDirectorySearches
serviceget Name, Caption, State, ServiceType, StartMode, pathname
shareget name, path, status
sounddevget Caption, DeviceID, PNPDeviceID, Manufacturer, status
startupget Caption, Location, Command
sysaccountget Caption, Domain, Name, SID, SIDType, Status
sysdriverget Caption, Name, PathName, ServiceType, State, Status
systemenclosureget Caption, Height, Depth, Manufacturer, Model, SMBIOSAssetTag, AudibleAlarm, SecurityStatus, SecurityBreach, PoweredOn, NumberOfPowerCords
systemslotget Number, SlotDesignation, Status, SupportsHotPlug, Version, CurrentUsage, ConnectorPinout
tapedriveget Name, Capabilities, Compression, Description, MediaType, NeedsCleaning, Status, StatusInfo
timezoneget Caption, Bias, DaylightBias, DaylightName, StandardName
useraccountget AccountType, Description, Domain, Disabled, LocalAccount, Lockout, PasswordChangeable, PasswordExpires, PasswordRequired, SID

Ayuda WMIC

Anexo una captura de la ayuda WMIC al escribir en el Command Prompt help wmic

Help WMIC

Califica este articulo

Fernando O.

Soy analista de sistemas actualmente trabajo en una empresa con mas de 200 empleados que utilizan equipo de computo al cual se les da soporte en el departamento.
Uno de mis pasatiempos fuera de la empresa es escribir artículos para PortalMasTips donde documento los problemas, inquietudes y detalles interesantes que se presentan.

Deja un comentario...

Compartir
Twittear
+1
Compartir
Pin
Stumble