Quantcast
Channel: Andrew Morgan » SQL
Viewing all articles
Browse latest Browse all 2

Pulling detailed thin client reports from Igel’s UMS with Powershell.

$
0
0

I needed a full and detailed list recently of all Igel thin client devices and was disapointed with Igels built in views and reporting options. As with my previous Powershell and SQL scripts I set about getting into the Igel database and pulling the information I required.

This script is fairly “Niché” so I’ve not included my usual list of options and explanations, feel free to request more detail if needed.

This script will pull alot of useful information of the device, from mac address to firmware id and return a full table of contents from your Universal Management Server. as below:

This script only supports trusted connections, so the account you run the script as needs access to the database. If you need to configure non trusted connections, have a look at my Edgesight or SQL backup scripts for inspiration.

The only options you need to configure are the SQL servername and database name, these can be found at the start of the script as below:

The script itself can be found after the jump:

 

[sourcecode language=”Powershell”]

$SQLServer = "servername"
$SQLDatabase = "rmlogin"

$SQLTrustedConnection=$true
$SQLConn = New-Object System.Data.SQLClient.SQLConnection
$SQLConn.ConnectionString = "Server=$SQLServer; Database=$SQLDatabase; Trusted_Connection=True"

if ($SQLserver -eq ""){write-warning "The SQL Server variable must be defined, Closing without fully loading module, please ensure you’ve defined this entry and try import this module again.";break}
if ($SQLDatabase -eq ""){write-warning "The SQL Database variable must be defined, Closing without fully loading module, please ensure you’ve defined this entry and try import this module again.";break}
write-host "Attempting to connect to the EdgeSight Database: " -nonewline -foregroundcolor yellow
try {$SQLConn.Open()}
catch {
write-host "Failed!" -foregroundcolor Red
Write-warning "An exception was caught while attempting to open the SQL connection, please confirm the login details are correct and attempt to Re-Import this module."
Break}
write-host "Success!" -foregroundcolor Green
$sqlconn.close()

function get-thinclients{

if ($SQLconn.state -ne "Open"){
$SQLConn.Open()}

$SQLCmd = New-Object System.Data.SQLClient.SQLCommand
$SQLCmd.CommandText ="SELECT s.tcname,s.macaddress,s.site,s.tccomment,s.lastknownip,p.devicetype,s.Productid,p.ostype,p.cpu_speed,p.cpu_type,p.flashsize,p.memorysize,p.graphicschipset0,f.modelname,f.version
FROM rmlogin.ADDITIONAL_SYSTEM_INFORMATION AS p
INNER JOIN rmlogin.THINCLIENT AS s ON s.macaddress = p.mac
INNER JOIN rmlogin.firmware as f on s.firmwareid = f.firmwareid"
$SQLCmd.Connection = $SQLConn
$SQLAdapter = New-Object System.Data.SQLClient.SQLDataAdapter
$SQLAdapter.SelectCommand = $SQLCmd
$DataSet = New-Object System.Data.DataSet
$SQLAdapter.Fill($DataSet) | out-null
$dataset.tables[0] | % {$members+=@($_)}
$SQLconn.close()
return $members
}
[/sourcecode]


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images