20 lines
779 B
Bash
20 lines
779 B
Bash
#!/bin/bash
|
|
|
|
# Author: Petar Cubela
|
|
# Description: This script filters out all VMs in our pool where the guest could be missing an integratin in ninjaone.
|
|
|
|
|
|
|
|
# Filter out all doubly occuring hosts+company combinations and false positive results
|
|
tail -n +2 vms_and_server.csv | sort -f -t, -k1,2 | cut -d ',' -f 1-2 | uniq -u -i | grep -Ev "vCLS|vCenter|^3V*" > unique-hosts.txt #last grep removes photon os machines and false positives
|
|
|
|
#tail -n +2 vms_and_server.csv | sort -f -t, -k1,2 | cut -d ',' -f 1-2 | uniq -u -i | tee unique-hosts.txt
|
|
|
|
# Set csv header line
|
|
#head -n1 vms_and_server.csv >vms.csv
|
|
|
|
while read line; do
|
|
#grep "$line" vms_and_server.csv | grep -E "VM|Virtual" >>vms.csv
|
|
grep "$line" vms_and_server.csv | grep -E "VM|Virtual"
|
|
done < unique-hosts.txt
|