One Liners for Solaris

Get disks attached to HBA

for i in `fcinfo hba-port |grep WWN|grep HBA|awk '{print $4}'`; do fcinfo remote-port -sl -p $i; done
hostname;fcinfo hba-port |grep WWN|grep HBA|awk '{print $4}'

Logical Domains

Add Vnets from List
for i in `ldm list |awk '{print $1}'|grep -v NAME|grep -v primary`; do ldm add-vnet linkprop=phys-state vnet0 public-vsw0 $i; ldm add-vnet linkprop=phys-state vnet1 public-vsw1 $i; ldm add-vnet linkprop=phys-state vnet2 dev-vsw0 $i; done

Get Lun Ids within the Ldom 
inq -nodots |grep rdsk|grep -v c0d0s2|grep -v c0d1s2|awk '{print $5}'|sed s/:330//|sed s/000//

# Check ldom disks
for i in `cat /var/tmp/emcdisks_hbs.o `; do vxprint |grep -i $i; done|wc -l

# Get vdisks for vds1
ldm list -o disk <hostname> |grep vds1|awk '{print $1 " " $2}’

# Remove vdisks for backup
for i in `ldm list -o disk <hostname>|grep backup|awk '{print $1}'`; do ldm remove-vdisk $i <hostname>; done
#Remove the orig source disks
for i in `ldm list -o disk <hostname>|grep primary-vds1|awk '{print $1}'`; do ldm remove-vdisk $i tsphbs1a; done

# Get vdisks for vds1
ldm list -o disk <hostname> |grep vds1|awk '{print $1 " " $2}’

# Remove vdisks for backup
for i in `ldm list -o disk <hostname>|grep backup|awk '{print $1}'`; do ldm remove-vdisk $i <hostname>; done
# Remove the orig source disks
for i in `ldm list -o disk <hostname>|grep primary-vds1|awk '{print $1}'`; do ldm remove-vdisk $i <hostname>; done

Publisher

# Publisher
pkg set-publisher \
-k /var/pkg/ssl/pkg.oracle.com.key.pem \
-c  /var/pkg/ssl/pkg.oracle.com.certificate.pem \
-G "*" -g https://pkg.oracle.com/solaris/support/ solaris

pkg set-publisher -G '*' -g  /export/repoSolaris11.2/ solaris

Zones/Containers

# Copy files for zones
for i in `zoneadm list -c|grep spa|grep -v <zonename>`; do cp /zones/<zonename>/root/usr/local/etc/sudoers /zones/$i/root/usr/local/etc/sudoers; done

for i in `zoneadm list -c|grep spa|grep -v <zonename>`; do cp /zones/<zonename>/root/etc/passwd /zones/$i/root/etc; done

# Add host to zones
for i in `zoneadm list -c|grep <zonename>`; do zlogin $i  echo '"10.128.0.131 <FQDN> <hostname>" >>/etc/hosts'; done

# Zonecfg oneline
zonecfg -z <zonename> "add fs; set dir=/usr/local/download;set special=/zones/<zonename>/root/usr/local/download;set type=lofs;end;verify;commit" 

# Copy printer info, Start
for i in `zoneadm list -c|grep <?>|grep hbs|grep -v <hostname> |grep -v <hostname>`; do cp -rp /zones/<hostname>/root/etc/lp /zones/$i/root/etc/; cp -rp /zones/<hostname>/root/etc/printers /zones/$i/root/etc/; cp -rp /zones/<hostname>/root/etc/interfaces /zones/$i/root/etc/; cp -p /zones/<hostname>/root/etc/printers.conf /zones/$i/root/etc/; cp -p /zones/<hostname>/root/opt/hpnp.tar /zones/$i/root/opt; done

for i in `zoneadm list -c|grep <?>|grep <?>|grep -v <hostname>|grep -v <hostname>`; do cp -rp /zones/<hostname>/root/etc/lp /zones/$i/root/etc/; cp -rp /zones/<hostname>/root/etc/printers /zones/$i/root/etc/; cp -rp /zones/<hostname>/root/etc/interfaces /zones/$i/root/etc/; cp -p /zones/<hostname>/root/etc/printers.conf /zones/$i/root/etc/; cp -p /zones/<hostname>/root/opt/hpnp.tar /zones/$i/root/opt; done

svcadm  enable -r /application/print/rfc1179 

lpstat -v |awk '{print "/usr/bin/enable" " "  $3}'|sed s/://
lpstat -v |awk '{print "/usr/sbin/accept" " "  $3}'|sed s/://

lp -d hp_jh02 /etc/group
lp -d hp_hi04 /etc/group
lpstat -o all

# Check TSM versions
for i in `zoneadm list -c |grep paz`; do echo $i;zlogin $i " pkginfo -l TIVsmCapi|grep VERSION"; done

Misc

# Reset hba to upgrade firmware
luxadm -e forcelip /devices/pci@1,700000/pci@0/pci@0/SUNW,emlxs@0/fp@0,0:devctl
# Grep multiple lines in file
fcinfo hba-port |awk '/HBA//State/'