This guide will walk you through creating a Machine Label from a spreadsheet containing a list of machines.
Step 1:
Save the spreadsheet containing your list of computers as a CSV (Comma delimited) file.1
Step 2:
Method 1: Copy these commands to a .cmd file:
Commands: @echo off > NEW%1.txt & setLocal enableDELAYedexpansion |
Save this .cmd file to the same directory as your CSV file. Run the cmd file along with the name of your CSV file from a command prompt. e.g. create a cmd file called "commaToREGEX.cmd" and run:
Command: c:\commaToREGEX.cmd myCSVFile.csv
|
This will create a new file called NEW[your csv filename].txt. Open this txt file - you will use it in Step 4. Skip to Step 3.
Method 2: Open the file in any text editing software that allows you to search and replace text. Search for commas and replace them with the pipe "|" symbol which is located on the backslash "\" key. Add "^(" to the beginning of the list, and ")$" to the end. The result should look like:
^(PC_1|PC_2|PC_3)$
Leave this file open - you will use it in Step 4.
Step 3:
Open the K1000 WebUI, navigate to Inventory > Computers and click "Create Smart Label."
Change the criteria to: System Name > matches REGEX > PC_LIST
*PC_LIST is a place holder which we will overwrite. Enter a name for the label and click Create Smart Label.
Step 4:
Navigate to Home > Label > Smart Labels and select the label you just created. The last line of SQL should show:
where (( MACHINE.NAME rlike 'PC_LIST'))
Copy the text from Step 2. On the K1000 WebUI, replace PC_LIST (not the single quotes surrounding it) on the last line of SQL with your list resulting in a line like this:
where (( MACHINE.NAME rlike '^(PC_1|PC_2|PC_3|PC_4|PC_5)$'))
Click Save. This label will contain all PCs in the list. Machines are added to a smart label as they check in, so it will take some time for the label to populate.
1 Your spreadsheet must contain the list of machines in a single row, not in a column, to create a proper comma delimited file. See this page for information on converting a column of data to a row: http://office.microsoft.com/en-us/excel-help/rotate-data-by-converting-columns-to-rows-or-vice-versa-HP005203138.aspx
@echo off > NEW%1.txt & setLocal enableDELAYedexpansion
if its separated it would give you an error, it has to be one line - josefino 10 years ago
$CSVsource =Import-Csv -Path 'C:\temp\Convertor\CSVData.csv'
# "^($($CSVsource.Devices -join '|'))$"
"^(" + $($CSVsource.Devices -join '|') + ")$" | Out-File C:\temp\Convertor\CSVDatatoREGEX.txt - Levio 2 years ago