While trying to set our Dell servers to have a helpful asset tag on the LCDs, we noticed that ipmitool's delloem set mode function was not working. Seeing as ipmitool is on hold due to sanctions, we tried to find an alternative solution.
From some old mailing list thread [0], and a blog post[1], we managed to change the LCD user string, however only when manually setting "Home" to be User String.
By staring at the code for a couple hours, we figured out why the existing set LCD mode command was not working - the 0x00 sent was not enough, as multiple parameters needed to be set each time. By adding the trailing zeroes, this command now works on our Precision 7920 Rack machines.
#!/usr/bin/python3
from subprocess import call
from sys import argv
user_string = ' '.join(argv[1:])[:14]
hex_string = ' '.join([hex(ord(z)) for z in user_string])
call('/usr/bin/ipmitool raw 0x6 0x58 0xC2 0 0 0 0 0 0 0 0 0 0 0 0', shell=True)
call('/usr/bin/ipmitool raw 0x6 0x58 0xC1 0 0 {0} {1}'.format(str(len(user_string)), hex_string), shell=True)
To get it to work, you might have to change the path to ipmitool, and perhaps add interface, host, password, etc. arguments depending on your setup.
This was done by Emil Karlsson and I, while working on kthcloud.
See the original creators in the sources below.
This code is licensed under the MIT license. Feel free to use it :)
[0] https://www.mail-archive.com/ipmitool-devel@lists.sourceforge.net/msg00352.html
[1] https://www.tannr.com/2010/03/20/changing-an-lcd-string-on-a-dell-server-remotely-with-python/