wmic

WMIC Returning Odd Serial Number

强颜欢笑 提交于 2019-12-05 12:00:41
I have an odd issue. I'm attempting to return the hard drive serial number from WMIC to a variable in a batch file; the line that gives me the variable is: for /f "skip=2 tokens=2 delims=," %%a in ('wmic diskdrive get serialnumber /FORMAT:CSV') do (set harddisk=%%a) This assigns what wmic sees as the serial number for the hard drive to a variable, the issue is that the serial number it returns is slightly off. In one example it returns: 3ZVT01H4 But the serial number on the label is: Z3TV104H It seems as though it is taking the actual serial number and reversing every two characters; am I

Issue with batch file encoding

自古美人都是妖i 提交于 2019-12-04 16:56:43
I have a batch file script I am trying to create to obtain some pretty basic info on the computers at my job site. However, I am having severe issues with encoding. WMIC and IPCONFIG put out different encodings, and as such, it is causing me to obtain garbled results when the commands execute. Thus far, I have: @echo off if exist "C:\%computername%-info.txt" ( echo Your computer information is already published! Skipping ) else ( ipconfig /all > "C:\%computername%-info.txt" wmic bios get serialnumber >> "C:\%computername%-info.txt" ) pause The results are...weird. I don't know what the encoded

Get maximum supported resolution of all attached monitors

萝らか妹 提交于 2019-12-04 11:33:35
I'm trying to get the maximum supported resolution of both of my monitors using WMI (since it will be part of a VBScript)I've tried the following WMI commands, but I either get a wrong result or only get info for one monitor. C:\>wmic path win32_videocontroller get videomodedescription /format:list VideoModeDescription=1366 x 768 x 4294967296 colors C:\>wmic path win32_displaycontrollerconfiguration get videomode /format:list VideoMode=1024 by 768 pixels, True Color, 60 Hertz According to Display Settings, my laptop monitor is 1366x768... No clue where WMI is getting 1024x768 from. Plus, if I

How to find a process pid with wmic and kill it with taskkill

假装没事ソ 提交于 2019-12-04 10:25:11
I need to find a process PID with WMIC command, and then kill this process with taskkill. I've almost achieved that, but the only problem is there is a newline on the end of the PID variable. So far i made this: c:\patryk>for /F "skip=1 tokens=*" %a in ('wmic process where "CommandLine like '%sourceprocessor%' and name like '%java%'" get ProcessId') do taskkill /pid | set /p pid=%a So this is looping through the output of wmic which contains 3 lines: title (ProcessId), found PID (a number) and an empty line. I'm skipping first line, because it's just title. Now i want to kill a process with

Powershell get-item VersionInfo.ProductVersion incorrect / different than WMI

让人想犯罪 __ 提交于 2019-12-04 08:52:24
I'm trying to understand why Powershell would get back a different version number for a DLL file than what both the file properties page from Windows Explorer, and a WMI query shows. (I apologize in advance if this doesn't correctly qualify as a coding question.) The scenario: Running the following powershell command: (get-item C:\windows\system32\rdpcorekmts.dll).VersionInfo.ProductVersion This returns the following: 6.1.7600.16385 However, this version number is incorrect. When examining the version information from Windows Explorer, you see the following version (sorry, I tried posting a

Looking to Rename Computers with csv file and .vbs script

谁说我不能喝 提交于 2019-12-04 06:52:22
问题 I would love to do this in Powershell but that isn't an option. I have a bunch of computers I'm looking to rename and am trying to automate the process as much as I can. I'd like to have a csv file setup with two columns (oldname,newname) and be able to pull that info into a vbs script to rename the computers automatically. The code to rename an individual computer is: Name = "wantedcomputername" Password = "localadminpassword" Username = "localadminusername" Set objWMIService = GetObject(

WMIC: how to use **process call create** with a specific working directory?

人盡茶涼 提交于 2019-12-03 15:04:50
The task is to launch a program using wmic process call create "c:\folder\app.exe" and have app.exe access it's own support files in the app.exe home folder tree . The batch script below illustrates the problem with WMIC silently changing the working directory, so that the support files cannot be found. This script creates a second batch file called one.bat that simply types a url.txt file from the same folder, to display www.google.com on the console. When using wmic to create the process, wmic silently changes the working directory so that one.bat is not found and if I specify the full path

What “wmic bios get serialnumber” actually retrieves?

风格不统一 提交于 2019-12-03 12:44:19
I wonder what sort of serialnumber wmic bios get serialnumber Windows commad actually gives you? Is it serial number of your motherboard? Documentation is not clear about it. the wmic bios get serialnumber command call the Win32_BIOS wmi class and get the value of the SerialNumber property, which retrieves the serial number of the BIOS Chip of your system. Stanley-Paul Ihunanyachukwu run cmd Enter wmic baseboard get product,version,serialnumber Press the enter key. The result you see under serial number column is your motherboard serial number wmic bios get serialnumber if run from a command

How to view user privileges using windows cmd?

好久不见. 提交于 2019-12-03 06:40:13
问题 I am trying to view the user privileges using the command prompt in Windows. User account & User privileges such as SeBatchLogonRight SeDenyBatchLogonRight SeInteractiveLogonRight SeDenyInteractiveLogonRight SeServiceLogonRight SeDenyServiceLogonRight SeNetworkLogonRight SeDenyNetworkLogonRight.....etc. I tried using ntrights but it's not working. I can't use any tool as I am trying to create an automated script for an OS audit. Thanks in advance. 回答1: I'd start with secedit /export /areas

How to view user privileges using windows cmd?

谁说胖子不能爱 提交于 2019-12-02 20:19:49
I am trying to view the user privileges using the command prompt in Windows. User account & User privileges such as SeBatchLogonRight SeDenyBatchLogonRight SeInteractiveLogonRight SeDenyInteractiveLogonRight SeServiceLogonRight SeDenyServiceLogonRight SeNetworkLogonRight SeDenyNetworkLogonRight.....etc. I tried using ntrights but it's not working. I can't use any tool as I am trying to create an automated script for an OS audit. Thanks in advance. I'd start with secedit /export /areas USER_RIGHTS /cfg OUTFILE.CFG . Then examine the line for the relevant privilege. However, the problem now is