Wednesday, May 22, 2013
Using VMware PowerCLI to get LLDP switch information
$vmh = Get-VMHost | sort
If ($vmh.State -eq "Connected")
{
Get-View $vmh.ID | `
% { $esxname = $_.Name; Get-View $_.ConfigManager.NetworkSystem} | `
% { foreach ($physnic in $_.NetworkInfo.Pnic) {
$pnicInfo = $_.QueryNetworkHint($physnic.Device)
foreach( $hint in $pnicInfo ){
# Write-Host $esxname $physnic.Device
if ( $hint.LLDPInfo ) {
$results = New-Object –TypeName PSObject
$results | Add-Member –MemberType NoteProperty –Name ESXHostName –Value $esxname
$results | Add-Member –MemberType NoteProperty –Name DeviceName –Value $physnic.Device
$results | Add-Member –MemberType NoteProperty –Name PortName –Value $hint.LldpInfo.Parameter[4].value
$results | Add-Member –MemberType NoteProperty –Name SwitchName –Value $hint.LldpInfo.Parameter[6].value
Write-Output $results
}
}
}
}
}
Wednesday, March 13, 2013
How to Flash Google Search Appliance to Dell R710 BIOS
The two Google Search Appliances I have converted have 48GB RAM, 2 Sockets with 4 cores each, and 6 x 1 TB SATA drives.
The conversion process is pretty simple--but this is about as invasive as you can get--so proceed at your own risk. You may end up with a brick.
- Clear the BIOS password. Unplug the power. Open the top cover and look just behind the left CPU and memory area. There is a double jumper. You will be moving the back jumper to the alternate position. Then plug in the power and start up the server. You should see a message saying the BIOS password is disabled. Power the server back off. Unplug the power. Move the jumper back. The jumper location is marked on the schematic on the inside of the cover if you have any problem finding it.
- Erase the hard drive setup. Power on the server. Hit Ctrl-R when you reach the PERC controller post message. Up arrow to the controller and hit F2. Choose clear configuration. Confirm and all the logical drives should disappear. You can make a new logical drive at this point if you wish, or do that later. Hit escape and then CTRL-ALT-DEL to restart when prompted.
- Make a bootable USB drive. You will need a small blank USB thumb drive to boot off of temporarily. Make the thumb drive bootable using Rufus which is widely available. Here is one location. Run rufus, set the file system to FAT32 and the bootable OS type to MS-DOS. Make sure you have selected the correct drive before you hit start!
- Download the latest Dell BIOS. Navigate to the Dell support site. Change the Operating System in the Refine Results to BIOS. Wait a second for the page to refresh and open the BIOS item in the list below. Click download and choose the non-packaged version which will be named like: R710-060300C.exe. Copy that file onto the root of the USB drive and give it a short name like r710bios.exe.
- Put the USB drive in the R710. Power the server up and after post completes press F11 to enter the boot bios manager. Down arrow to the hard drive entry and choose your USB drive from the pop-up. The server should boot from the USB drive and come to a dos C:> prompt.
- type r710bios.exe /forcetype. You need the forcetype switch to override the normal checks to ensure the server is the correct model--which is why this is dangerous but worked fine for me. The server will apply the bios and when finished prompt you to press a key. The server will restart and the Google BIOS messages will be replaced with the stock Dell firmware messages.
- Congratulations! Install your OS!
Wednesday, March 6, 2013
QlikView Query OLEDB error on Query that runs against Oracle in other products
Quick Description: A query valid in products like Toad/SQLPlus blows up with a non-descriptive OLEDB error in QlikView
Using the fake query below as an example:
QVTable:
Select
table1.field1,
table1.field2,
table1.field3,
table1.field4,
table2.field5,
table2.field6,
table3.field2,
table3.field7
from
table1 join table2 on table1.key1 = table2.key1
join talble3 on table2.key2 = table2.key2;
The culprit is that QlikView appears to ignore the table specification and sees table1.field2 and table3.field2 as ambiguous, causing an OLEDB error with no further information. It makes sense considering the fact that a load statement doesn't need to qualify tables from a select statement with joins and would therefore not have a way of knowing which field was being loaded. It still threw me for a loop troubleshooting a generated query with a pretty long list of joined fields.
Aliasing the fields as below fixes the problem.
QVTable:
Select
table1.field1,
table1.field2 as table1_field2,
table1.field3,
table1.field4,
table2.field5,
table2.field6,
table3.field2 as table3_field2,
table3.field7
from
table1 join table2 on table1.key1 = table2.key1
join talble3 on table2.key2 = table2.key2;
One other thing that can cause an uninformative OLEDB error on a query that runs in other products is a date field that Oracle doesn't like by the time QlikView has interpreted it. Forcing it to char then to date has, in my experience, fixed this issue. For example:
SELECT CURRENT_DATE FROM DUAL
could need to be formatted as
SELECT TO_DATE(TO_CHAR(CURRENT_DATE, 'MM-DD-YYYY'), 'MM-DD-YYYY') FROM DUAL
Thursday, September 20, 2012
Using Dell racadm to configure passwords with spaces fails on iDRAC 6
When using Dell racadm tool to reconfigure the iDRAC 6 an attempt to set a user password with spaces in it will fail. The manual provides information on proper quoting rules and escape rules, but none of them work properly as of version 7.1.0 (Build 594). This behavior occurs whether using the cfgUserAdminPassword property directly on the command line or through the use of a config file.
Errors are similar to the following:
ERROR: Invalid value in config file.
Group: cfgUserAdmin, Object: cfgUserAdminPassword, Value: "Some spacey password", Line [4]
or
ERROR: The specified object value is not valid.
It is possible to set a password with a space in it using the web interface.
Host state doesn't match specification when checking host profile compliance on ESXi 5
When checking host profile compliance on VMware ESXi 5, you receive errors similar to these:
Host state doesn't match specification: Rule ????? of class VAAI needs to be deleted from the host
Host state doesn't match specification: SATP VMW_SATP_DEFAULT_AA needs to be set to use Path Selection Policy VMW_PSP_FIXED by default
Host state doesn't match specification: device mpx.vmhba34:C0:T0:L0 Path Selection Policy needs to be set to default for claiming SATP
This persists despite changing the properties to "Enable/Disable Profile Configuration" and unchecking the relevant sections.
Solution:
Don't be so tidy! You can create this problem by manually removing all unwanted entries from the profile. Instead just uncheck the sections you don't want enabled. Removing the entries should work, but it doesn't. At a minimum retain the subsections under "Storage Configuration" titled "Pluggable Storage Architecture (PSA) configuration" and "Native Multi-Pathing (NMP)".
Thursday, August 30, 2012
SSIS Date Error Going From SSIS Variable to Stored Procedure using OLE DB
Quick Description: An SSIS package which populates an SSIS variable of type DateTime and passes the variable as a parameter to a stored procedure (expecting DateTime) using OLE DB blows up with the error below.
[Execute SQL Task] Error: Executing the query "exec <procedure>..." failed with the following error: "Invalid time format". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
One Solution: In my situation it turned out to another run-in with the deeply confusing datatype mappings in SSIS (2012 in my case). According to this Microsoft article the mapping for SQL Server DateTime is DT_DBTIMESTAMP. For an Execute SQL task calling a stored procedure (using OLE DB) expecting a DateTime parameter, however, this blows up with the error above. Setting the parameter to type DATE (not DT_DATE), fixed the problem for me, and the parameter is populated with a full Date/Time (including fractional seconds).
Tuesday, August 21, 2012
Quick C# Code to get the Current Windows User in a WebApp and do Something (like a lookup against a Database) with it.
I (not actually that recently anymore) changed positions from IT to development, and since it will probably be years before I'm an expert, I haven’t had much to post, lest I get another “Duh” comment. I have no pride, so I’m going to start posting what I’m sure are ridiculously basic snippets in case they're helpful.
This isn’t particularly advanced. I wanted to capture the windows username of the current user minus the domain, and look it up against an employee database to find employee info. Basic, but can be cannibalized for a lot of basic operations on a username.
Things not to do: For a WebApp, don’t get WindowsIdentity.GetCurrent().Name; this will appear to work while you’re debugging, but once it’s running, it will pull the User Account of the application pool. I haven’t been able/didn’t try to test kerberos/pass-through authentication with it, but I’m guessing in that case the app id would return the current user id – still seems like a lot more work than getting it at the front door.
Things I don’t understand: So many things, but in particular… How come Microsoft recommend using “using” specifically excluding IDisposable.Dispose and try…catch, but when I run code analysis it complains
Warning 7 CA2000 : Microsoft.Reliability : In method 'mymethod' call System.IDisposable.Dispose on object 'connectionobject' before all references to it are out of scope.
Weirdness notwithstanding, In the example below, I'm calling a stored procedure to look up employeeid in a database table, but any operation could be substituted.
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Security.Principal;
protected string GetEmployeeIDfromUname() //returns a string, if you don't want to return anything use protected void
{
//Do not get the string below unless you want to know who the application is running as//String empuname = WindowsIdentity.GetCurrent().Name;//Get Windows UserName of current user
string strEmpUname = HttpContext.Current.User.Identity.Name.ToString();
string strEmpUname parsed = strEmpUname.Substring(strEmpUname.LastIndexOf('\\') + 1); //Parse username to remove the domain name (remove everything up to and including the \)
string strEmployeeID; //variable to hold the return value;
//This section can be replaced by whatever action you want to do.
using (SqlConnection connectionEmpID = new SqlConnection("Your Connection String")) //Instantiate the connection and build the command as executable code and parameters
{
SqlCommand cmdEmpID = new SqlCommand();
cmdEmpID = new SqlCommand("YourProc", connectionEmpID);
cmdEmpID.CommandType = CommandType.StoredProcedure;
//Pass the parsed username to the procedure
cmdEmpID.Parameters.Add("LOGINNAME", SqlDbType.VarChar).Value = strEmpUnameParsed ;
SqlParameter empidret = cmdEmpID.Parameters.Add("@EMPIDRET", SqlDbType.Int);
//define the output (Employee Number)
empidret.Direction = ParameterDirection.Output;
cmdEmpID.Connection.Open();
cmdEmpID.ExecuteNonQuery();
strEmployeeID = cmdEmpID.Parameters["@EMPIDRET"].Value.ToString();
}
return strEmployeeID;
}