wmic

Looking to Rename Computers with csv file and .vbs script

ⅰ亾dé卋堺 提交于 2019-12-02 13:12:23
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("Winmgmts:root\cimv2") 'Call always gets only one Win32_ComputerSystem object. For Each objComputer In

wmic failure with concurrent calls on XP and Server 2003

社会主义新天地 提交于 2019-12-02 09:47:48
I am using wmic to get the time. I have narrowed this down to a one (1) line .bat file. I have learned from stackoverflow about piping stdin and stdout to avoid hangs. C:> type t.bat TYPE NUL | wmic os get localdatetime | findstr . It seems that if I run wmic concurrently, it will occasionally fail. If I create two cmd shells and run the following command in each, errors similar to the one below appear. for /l %i in (0,1,100) do (call t.bat) ... C:> TYPE NUL | wmic os get localdatetime | findstr . Win32 Error: The process cannot access the file because it is being used by another process. This

Is it possible to send a file to a printer with a batch file?

倖福魔咒の 提交于 2019-12-02 02:05:21
How can I use a batch file to send a text file or a .doc or similar, to a printer plugged into the computer through a USB port? Also to get the printer name: wmic printer get name /value | findstr Name It will list all printers like: Name=PDF Name=Microsoft XPS Document Writer Name=Fax And if you know part of the name, you may include it in a variable dynamically with FOR . @echo off for /f "tokens=2 delims==" %%a in ( 'wmic printer get name /value ^| findstr PartOfThePrinterName' ) do ( set "printer_name=%%a" ) REM Also you can remove the FOR command if you want to set the variable as static.

WMIC command in batch outputting non UTF-8 text files

拟墨画扇 提交于 2019-12-01 05:44:55
I'm using a WMIC command to output a list of SIDS and accompanying user profile names to text. From the text, I can edit a list of SIDS I need to add a set of registry keys to. However, the script that loops through the edited text file of SIDS is encoded in a format the script doesn't pick up and just fails to run. Using notepad++ I can re-encode from UCS-2 LE BOM to UTF-8 and then I can complete the script hassle free. How can I make the output from the WMIC text default to UTF-8 ?. I noticed this on more that one PC. To cure the problem, as mentioned, I can re-encode in notepad++ but its a

Get Interface name, IP and MAC in Windows Command line

Deadly 提交于 2019-12-01 03:35:56
问题 I want to get a list of all the interfaces, IP and MAC address on a machine. I have quite a few machines to get this information from (around 600) and I can't use a batch file on the devices. I would like to send the command and get back an echoed output. All the info I need is in ipconfig /all but I am not sure how to go about parsing that out with a for loop. I am still quite new to that complex of a loop. Essentially I need to get a one liner output if possible. Any suggestions? hostname,

How to get total physical memory (ram) information in GB by WMI query?

落爺英雄遲暮 提交于 2019-11-29 12:56:59
I know how to get total physical memory from win32_computersystem class. but that comes in bytes or kb. I want this information in MB or GB. in wmi (wql) query. wmic also work. thanks in advance. You must convert the value of the property manually. Also is better use Win32_PhysicalMemory WMI class. Try this sample using System; using System.Collections.Generic; using System.Management; using System.Text; namespace GetWMI_Info { class Program { static void Main(string[] args) { try { ManagementScope Scope; Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", "."), null); Scope

Batch WMIC redirecting output and wrapping into variable

大憨熊 提交于 2019-11-28 11:45:25
I'm trying to use WMIC to remove some old printers on our older print servers if I use the below syntax from the command line it works WMIC PRINTER WHERE "SERVERNAME LIKE '%%OLDSERVERNAME%%'" DELETE I was asked to see if I could make it replace the printers or update them to spare the helpdesk from getting "how do I add my printer" calls I tried some variation with SET to set the properties for SERVERNAME, it appear to process, but nothing changes and doing a GET shows the old value still. so I figured I could do a FOR /F loop, wrap the name of the printer (sharename) in a variable and then

How to get total physical memory (ram) information in GB by WMI query?

主宰稳场 提交于 2019-11-28 06:14:29
问题 I know how to get total physical memory from win32_computersystem class. but that comes in bytes or kb. I want this information in MB or GB. in wmi (wql) query. wmic also work. thanks in advance. 回答1: You must convert the value of the property manually. Also is better use Win32_PhysicalMemory WMI class. Try this sample using System; using System.Collections.Generic; using System.Management; using System.Text; namespace GetWMI_Info { class Program { static void Main(string[] args) { try {

Escaping strings when using wmic

烈酒焚心 提交于 2019-11-28 05:04:51
问题 I'm trying to sart an instance of VLC using wmic I'm doing this mainly because I want to capture the pid of the created process I know the command below works fine from the command line: C:\PROGRA~1\VideoLAN\VLC_117\vlc.exe rtsp://abcd --sout="#duplicate{dst=display, dst={std{access=file, mux=ps, dst='vlc_117/video.mpg'}}} --rtsp-caching=120 --no-video-title-show" (where rtsp://abcd can be any input file for the purposes of this example) Trying to run it via wmic, with various different

How to escape both comma and closing parenthesis in WHERE clause of WMIC?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 16:25:23
I am trying to retrieve the modification date of a file in a locale-independent manner, using the following wmic command: wmic DataFile WHERE Name="D:\\Data\\sample.txt" GET LastModified This works perfectly as long as the given file path does not contain any comma , . The method below allows commas in the file path but fails if a closing parenthesis ) appears: wmic DataFile WHERE (Name="D:\\Data\\sample.txt") GET LastModified Up to now, I tried numerous different combinations, but without success: WHERE Name=D:\\Data\\sample.txt (this fails in general, I guess due to wrong data type) WHERE