Login | |
|
 |
RE: Redirect parallel port to LPT2 - 11/22/2006 12:06:45 AM
|
|
 |
|
| |
gdewrance
Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
|
You may be able to do it throughthe registry It makes changes to the following registry key [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\PARALLEL PORTS] "\\Device\\Parallel0"="\\DosDevices\\LPT1" [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\PARALLEL PORTS] "\\Device\\Parallel1"="\\DosDevices\\LPT2" [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\PARALLEL PORTS] "\\Device\\Parallel2"="\\DosDevices\\LPT3"
|
|
| |
|
|
|
 |
RE: Redirect parallel port to LPT2 - 11/22/2006 12:14:04 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
While I was pondering this I see someone else came to the same conclusion. Modify the registry. I first thought you might be able to use the command line MODE command, but that only works if there is a LPT2 device detected, which it sounds like it isn't. You can use the WshShell object to modify the local registry or WMI to modify remote registries. Because the key is in HKLM, you'll most likely need admin rights to modify it.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: Redirect parallel port to LPT2 - 11/22/2006 12:20:42 AM
|
|
 |
|
| |
gdewrance
Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
|
The only problem is how do you create a key strating with \ e.g. "\Device\Parallel0" (it creates a new folder device) Dim Wshshell, path Set WshShell = CreateObject("Wscript.Shell") path = "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\PARALLEL PORTS" WSHShell.RegWrite path & "\Device\Parallel0", "\\DosDevices\\LPT1", "REG_SZ"
|
|
| |
|
|
|
 |
RE: Redirect parallel port to LPT2 - 11/22/2006 12:41:00 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
Crap. This is going to bug me until I figure this out.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: Redirect parallel port to LPT2 - 11/22/2006 12:48:10 AM
|
|
 |
|
| |
gdewrance
Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
|
got it. But I think he will need to delete previous value first Const HKEY_LOCAL_MACHINE = &H80000002 const REG_SZ = 1 strComputer = "." Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") 'Add paths as you see fit and remember to change the path below each statement to your disiried path strKeyPath = "HARDWARE\DEVICEMAP\PARALLEL PORTS\" 'StringValue strValueName = "\Device\Parallel0" strValue = "\\DosDevices\\LPT1" objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
|
|
| |
|
|
|
 |
RE: Redirect parallel port to LPT2 - 11/22/2006 12:50:39 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
I think this is a limitation with the Shell object. The better way, or at least one that works, is to just run REG.EXE from the command line like this: reg ADD "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\PARALLEL PORTS" /v "\DEVICE\PARALLEL1" /t REG_SZ /d "\DOSDEVICES\LPT2" REG has the added advantage is that it can remotely modify registries. Obviously, set what ever values you want. I just was testing the technique.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: Redirect parallel port to LPT2 - 11/22/2006 2:09:39 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
What I don't know, and what you'll have to test, is if the change requires a reboot before it is recognized.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
|
|