Thursday, July 23, 2015

Powershell | Array, Element, SQL

working on extracting elements from a array then uploading into SQL

#test array
$comp = New-Object System.Object
$comp | Add-Member -type NoteProperty -name DSAType -value "xtra"
$comp | Add-Member -type NoteProperty -name Hostname  -value "Host"
$comp | Add-Member -type NoteProperty -name Fails -value "failures"

#foreach ($comp in $warrantarray){
$cl=$null
$dl=$null
($comp|gm)|where{$_.membertype -eq 'noteproperty'}|% {
$cl+=$_.Name+","
$dl+=($comp).($_.name)+","
}
$cl=$cl.Substring(0,$cl.Length-1)
$cl
$dl=$dl.Substring(0,$dl.Length-1)
$dl
# do sql stuf... but write-hosting here...

write-host "INSERT INTO $dbTable ($cl) VALUES ($dl)"

#}

also possible to this way.

http://sphints.blogspot.com.au/2014/03/powershell-write-array-of-objects-to.html

Wednesday, July 8, 2015

BBQ Linux - IPC \ PACMAN update error

Just performed my 2nd built of antergos
for some reason PACMAN was having issues. :|

ran
# dirmngr  << dev
from https://bbs.archlinux.org/viewtopic.php?id=190380

and all was working again...