Page 1 of 1 1
Topic Options
#205804 - 2012-09-24 12:45 PM Problem with connecting printer at Windows 2008R2
mmuser Offline
Fresh Scripter

Registered: 2010-05-10
Posts: 14
Loc: Germany
Hi,

we use Kix 4.62. We have a mixed enviroment Windows 2003 and WIndows
2008 R2. At the end of our login Skrit we call an printerloginskript called
druckeranmeldeskript.kix.

If the user log in at an WIndows 2003 server the printer are connectet.
If the user logs in at an Windows 2008 server the printer are not connectet.

If the user runs at commandline: kix32.exe %logonserver\netlogon\druckeranmeldeskript.kix
ther printer are connected also at Windows 2008R2

This is a little excerpt from our printer loginskript:

 Code:
Function GetSessionID()
Dim $s_sessionid
Dim $iIndex	$GetSessionID = 0
$s_sessionid = SubStr(%TEMP%,1+InStrRev(%TEMP%,"\"))
While $s_sessionid <> ""
		$iIndex = InStr("0123456789ABCDEF",Left($s_sessionid,1))
		If $iIndex			
		$GetSessionID = $GetSessionID*16+(Cint($iIndex-1))
		$s_sessionid = SubStr($s_sessionid,2)
		Else		
		$GetSessionID = 0
		$s_sessionid = ""
		EndIf
		Loop
EndFunction

$clientn = %computername%
$printserver="servprt1" 
$printserver2="servprt2"
$printserver3="servprt3"
$printserverfw="servappl7"

;####################
;# Drucker zuordnen #
;####################

IF @PRODUCTSUITE = 16
$clientn = %clientname%
select
case InStr(@PRODUCTTYPE,"Server 2008")
      $clientn = ReadValue("HKEY_USERS\" + @SID  + "\Volatile Environment\" + getsessionid(),"CLIENTNAME")
	  $printserver="servprt3"
endselect
ENDIF

$Amt3 = Left ($clientn, 3)
$Amt4 = Left ($clientn, 4)
$Amt5 = Left ($clientn, 5)
$Amt6 = Left ($clientn, 6)

GOTO $Amt5
  
:Amt14

IF $clientn = "Amt1404"
    AddPrinterConnection ("\\"+$printserver+"\DAmt1003")
    SetDefaultPrinter ("\\"+$printserver+"\DAmt1003")
    RETURN  
ENDIF


I think i get clientname if the skript runs at commandline, but if i run
the skript at logon i dont get the clientname.
I have put an copy-Command after "If $clientn = "Amt1404" and the file wouldn't be
copied.


I have tried "Run logon scripts synchronously" in GPO, but nothing changed.

Any ideas ?

Kind Regards Christian


Edited by mmuser (2012-09-24 01:57 PM)
Edit Reason: Another Information

Top
#205805 - 2012-09-24 11:21 PM Re: Problem with connecting printer at Windows 2008R2 [Re: mmuser]
Robdutoit Offline
Hey THIS is FUN
***

Registered: 2012-03-27
Posts: 363
Loc: London, England
I don't have windows server 2008 R2, but the first thing that comes to mind is that when you are running kix32.exe %logonserver%\netlogon\druckeranmeldeskript.kix from the command prompt that you are in fact pulling the script from the windows 2003 server. There is nothing to indicate that its pulling it from the windows 2008 server.

The one thing that I am not sure about is this line:
IF @PRODUCTSUITE = 16
You need to check that windows server 2008R2 actually is = 16 for the @ProductSuite.
you will need to put this code into your script
? @PRODUCTSUITE
to see whether it actually returns the number 16. This is a terminal server and windows 2008r2 may not recognise itself as a terminal server in the @Productsuite macro.

I suspect that what is happening is that the script sees that the productsuite is not 16 and thus it bypasses that section which would explain why the file does not get copied.

When I find that I have problems with the script, I like to break the scripts into sections such as
? "Is this part running?"
and using different variations of the question and it makes it easier to see if the script is missing a section, because the script is not finding a true statement but rather seeing a false value like the @Productsuite=16 example.

I don't know if this is your specific problem, but hopefully it may be the answer


Edited by Robdutoit (2012-09-24 11:22 PM)
Edit Reason: added more info

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 793 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.446 seconds in which 0.229 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org