Change Computer Name to Serial

Little Windows VBS script to pull Dell BIOS serial tags into Computer Names. I pulled this from an old backup, since it got removed a long time ago for whatever reason.

strUser = "Administrator"
strPassword = "P@ssw0rd"

Set objNetwork = CreateObject("WScript.Network")
	strComputer = objNetwork.ComputerName

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
	strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
		strComputer & "'")

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
	strMsg = objItem.Caption
	If strMsg = "Microsoft Windows XP Professional" Then

		winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//."
		'WScript.Echo winmgmt1
			Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")
			for each SN in SNSet

				If SN.SerialNumber = strComputer Then
					MsgBox "Computer name already set! Name is: "& strComputer
					Wscript.Quit
				End If

				If SN.SerialNumber = "" Then
					MsgBox "Problem with computer naming!"
					Wscript.Quit
				End If

				ErrCode = objComputer.Rename(SN.SerialNumber, strPassword, strUser)

				If ErrCode = 0 Then
					MsgBox "Computer renamed successfully to: "& SN.SerialNumber
				End If

			Next

	End If
Next
By |January 6th, 2017|Categories: Code|Tags: , |0 Comments

Running Skyrim in Linux with WINE

A few days ago my cousin asked me to try and get Skyrim running for him on his Linux install using WINE.

I have previously gotten RIFT working on my Linux system flawlessly using WINE.

He gave me an ISO file, (probably from ill-gotten sources), and I proceeded to install from that.

Using winetricks I installed what all the other sites told me to install:


d3dx9_42
vcrun2008
xact

Then I ran the SkyrimLauncher.exe using WINE. Clicking low settings to start works, and then I click play… Nothing happens. Throws a minor error but nothing big. Ok…

So then I run TESV.exe directly, game loads in a virtual desktop as I had it setup, acting as its full screen (and annoyingly keeping my mouse inside the window). I click new game, and it sits at a black screen with gray fog floating from the bottom with the Skyrim symbol in the center of the screen. Hmm.

Well after poking around with some debug, for a few hours, I realized that the game is actually running from the Z: drive per this wine prefixes setting, and that I needed to tell it “Hey your actually running from the C: drive.”.

I looked quickly but could not find out how to force programs to run from C: in a wine config, so I created a simple command file “skyrim.cmd” file like the batch files of olde’ and inside I put the lines:


C:
CD \Program Files\Skyrim
TESV.exe

I saved the file inside my ~/.wine_skyrim/drive_c folder, and then to run the game I ran:


WINEARCH=win32 WINEPREFIX=~/.wine_skyrim wine cmd.exe /c ~/.wine_skyrim/drive_c/skyrim.cmd

Which actually ran my script, running wine at a Windows Command line, and then changed to the ‘fake’ C: drive, changed directories and ran the program.

The game runs, and then I click play. Boom, I am reading the story and it’s all working. I need to start the tweaking stage with the wine registry Direct3D entries but if anyone else has the black screen with fog try doing what I did.

By |January 31st, 2012|Categories: How To|Tags: , , , , , |3 Comments

Document Processing Source Code

This is the PHP console program service that Anthony and I programmed at work. We got the owner of the company to sign off a release form finally making the code available under the GPL.

Please note that this code will probably not work for you as a drop in place system, it will require tweaking, and lots of setup on your part. Please do not ask me for assistance.

Use this code at your own risk. You will need knowledge of Linux, PHP, Shell Scripts, and some common computer programming knowledge.

Folder structure for this program is as follows:
/tmp – Used for temporary storage of files for FDF merge into interactive PDF.
/usr/local/bin – Storage for all scripts this program uses. (dps.php, forge_fdf.php, file2pdf, pollerctl, dps_poller, hud-process.php)
/usr/local/dpsdocs – Root storage for following folders:
dpsdocs/merged – If save mode is on, saves raw ODT and PDF files in named folders.
dpsdocs/failed – Saves documents that failed to merge for some reason.
dpsdocs/monitor – If user chooses fake printer, will save the PDF here, instead of really printing it. Good for NFS/SMB share.
dpsdocs/templates – Live templates that the system pulls.
dpsdocs/test_templates – Test templates that you can SMB/NFS share for users to add tempaltes and you can sync to live later.
dpsdocs/xml_request – Where all the XML files get dumped to from which ever system you have generating them. Good to NFS/SMB share.

Files used and purpose:
dps.php – Main PHP program, does the merging and OOO operations. Takes in the XML as the first parameter and some others. Open file and view for yourself.
dps_poller – The program that loops continuously looking for newly dumped XML files. XML files that have specific printers are SCP’ed over the network to other servers running program so they build and print locally at that location.
file2pdf – This shell script gets called by dps.php and finishes the job, runs pdftk operations, and reads the sorting.txt file to decide where to print.
hud-process.php – Example PHP file that takes in FDF data and merges with specific PDF files. Called from dps.php.
pollerctl – Service script that makes sure the dps_poller is always running and never died for some reason.
tbs_class.php – TinyButStrong PHP class file, called from tbsooo_class.php.
tbsooo_class.php – TinyButStrong OpenOfficeOrg class file, called from dps.php.
zint – Console program that takes in data and creates a barcode. dps.php calls this, and creates a PDF417 barcode.

Document Processing PHP System

By |April 2nd, 2010|Categories: Code|Tags: , |0 Comments
Load More Posts