Jump to content

Recommended Posts

Posted (edited)

Hey Guys

 

Just had PaperCut installed, bit of a nightmare because the client will install perfectly fine on all the computers when a user logs in, although I can't get the client to boot at startup, the picture below shows what I did first and that didn't work so I tried again with the "" at each end and got rid of --silent which also isn't working, god-nab-it!

 

autolaunch-gpo.png

 

Any clues? I really want to use GP to deploy this so scripts and the like are out of the question, I must be doing something wrong surely?

 

Cheers :)

Edited by abillybob
Posted

why not launch it from the print server (assuming they have a network connection), ours just has

\\print01\PCClient\win\pc-client.exe --silent

 

You'd also need to allow that file to be run without asking for user approval.

Posted (edited)
why not launch it from the print server (assuming they have a network connection), ours just has

\\print01\PCClient\win\pc-client.exe --silent

 

You'd also need to allow that file to be run without asking for user approval.

 

Running it from the server can cause issues especially on Laptops when the Wi-Fi temporarily drops to connect to a new AP. I'd rather just run the installation.

 

ours is

 

C:\path\path\pc-client.exe

 

Thats without any switches, works fine.

 

Hmm exactly how I have mine setup... strange!

 

Edit: Started client from a User Accounts manually and it starts fine so I think permissions are all ok!

Edited by abillybob
Posted

Odd, we have that here with no issues. This is also the recommended papercut practice.

 

Can you actually put that in the run command box and launch the client that way?

Posted
I have this here and it works: "C:\Program Files\PaperCut NG Client\pc-client.exe" --silent --minimized --neverrequestidentity --windowposition bottom-right --windowtitle Print Management --default-selection charge-account-list
Posted (edited)
And does it ask for authorisation to run?

Does event viewer tell you anything?

 

No authorisation just runs like normal.. Event Viewer isn't saying anything as far as I can see. Grrrr just don't understand why it won't work!

 

Edit: Ah! Sorry tell a lie, I have found two errors in event viewer if this means anything to anyone :)

 

Capture.PNG

Capture1.PNG

Edited by abillybob
Posted
We are using the "local-cache" version (pc-client-local-cache.exe), is a smarter version that first copies itself and associated files to the local drive and launches itself from there.
  • 2 weeks later...
Posted

We use the local cache version too.

 

I have this set at user logon:

cmd /c "start \\\PCClient\win\pc-client-local-cache.exe --silent --minimized"

 

Seems to work ok.

Posted
Hmmm maybe I should try something different like using a script on all machines or something? Does anyone have a script I could use that can be applied via GP? :)
Posted

We use group policy to start it up.

 

Computer - Policies - Administrative Templates - System/Logon - Run these programs at user logon - c:\Program Files\PaperCut NG\pc-client.exe

 

Start every time.

Posted

Roll the client out using the MSI and then create a registry key in the 'Run' section of the registry to make the client run on login - that's how I've done it.

 

Also edit the config.properties file and program the settings in you want the client to use, it saves having to use all those switches.

 

Regards,

 

Mike.

Posted
We use group policy to start it up.

 

Computer - Policies - Administrative Templates - System/Logon - Run these programs at user logon - c:\Program Files\PaperCut NG\pc-client.exe

 

Start every time.

 

Tried again won't work for me for some reason!!! :(

Posted (edited)

Hi all,

 

I should add that I'm not actually running this version of the script - I wrote this script with the aim of reducing wireless traffic starting papercut, but never got around to putting it live - tested it on my box wiht various scenarios but never went live.

 

Anyway, disclaimer over, the script I came up with to run as a logon script was a vbs script as follows:

 

Set WshShell = WScript.CreateObject("WScript.Shell")

PapercutPath = "\\printserver\pcclient\win"
PapercutCachePath = "c:\cache"
ClientArguments = " --silent --minimized --neverrequestidentity"

LocalVersion = GetLocalPaperCutVersion(PapercutCachePath)
NetworkVersion = GetNetworkPaperCutVersion(PapercutPath)

Wscript.Echo "Local: " & LocalVersion
Wscript.Echo "Network: " & NetworkVersion

ClientToExecute = ""

Select Case CompareVersions( NetworkVersion, LocalVersion )
Case -1
	' Local Version 'newer' then network i.e. network not found
	ClientToExecute = PapercutCachePath & "\pc-client.exe-" & LocalVersion & "\pc-client.exe"
Case 0
	' Versions match, therefore local
	ClientToExecute = PapercutCachePath & "\pc-client.exe-" & LocalVersion & "\pc-client.exe"
Case 1
	'Network Update Available
	ClientToExecute = PapercutPath & "\pc-client-local-cache.exe"
End Select

Set objFSO = CreateObject( "Scripting.FileSystemObject" )

Wscript.Echo "Client To Execute: " & ClientToExecute
If objFSO.FileExists(ClientToExecute) Then	
WshShell.Run ClientToExecute & " " & ClientArguments
End If


Function GetLocalPaperCutVersion( Path)
   Dim fs, f, f1, fc, s, Version1
   Set fs = CreateObject("Scripting.FileSystemObject")
Version1 = "0.0.0.0"
   if fs.FolderExists( Path ) then
	Set f = fs.GetFolder(Path)
	Set fc = f.SubFolders
	For Each f1 in fc
		If InStr(1, f1.name, "pc-client.exe-") > 0 then
			Version2 = Replace( f1.name, "pc-client.exe-","")
			if CompareVersions(  Version2, Version1 ) = 1  Then
				Version1 = Version2
			End If
		End If
	Next
End If
GetLocalPaperCutVersion = Version1
End Function

Function GetNetworkPaperCutVersion( Path )
   Const ForReading   = 1

   Dim intEqualPos
   Dim objFSO, objIniFile
   Dim strFilePath, strKey, strLeftString, strLine, strSection

   Set objFSO = CreateObject( "Scripting.FileSystemObject" )

   strFilePath = Path & "\version.txt"

   If objFSO.FileExists( strFilePath ) Then
       Set objIniFile = objFSO.OpenTextFile( strFilePath, ForReading, False )
       Do While objIniFile.AtEndOfStream = False
           strLine = Trim( objIniFile.ReadLine )

           ' Check if section is found in the current line
           If LCase( strLine ) = "[version]" Then
               strLine = Trim( objIniFile.ReadLine )

               ' Parse lines until the next section is reached
               Do While Left( strLine, 1 ) <> "["
                   ' Find position of equal sign in the line
                   intEqualPos = InStr( 1, strLine, "=", 1 )
                   If intEqualPos > 0 Then
                       strLeftString = Trim( Left( strLine, intEqualPos - 1 ) )
                       ' Check if item is found in the current line
                       If LCase( strLeftString ) = "version-build" Then
                           StrBuild = Trim( Mid( strLine, intEqualPos + 1 ) )                            
                           If StrBuild = "" Then ' item exists but value is blank
                               StrBuild = "0"
                           End If
                       End If
                       If LCase( strLeftString ) = "version-minor" Then
                           StrMinor = Trim( Mid( strLine, intEqualPos + 1 ) )                            
                           If StrMinor = "" Then ' item exists but value is blank
                               StrMinor = "0"
                           End If
                       End If
                       If LCase( strLeftString ) = "version-major" Then
                           StrMajor = Trim( Mid( strLine, intEqualPos + 1 ) )                            
                           If StrMajor = "" Then ' item exists but value is blank
                               StrMajor = "0"
                           End If
                       End If
                   End If

                   ' Abort if the end of the INI file is reached
                   If objIniFile.AtEndOfStream Then Exit Do

                   ' Continue with next line
                   strLine = Trim( objIniFile.ReadLine )
               Loop
           Exit Do
           End If
       Loop
	GetNetworkPaperCutVersion = StrMajor & "." & StrMinor & ".0." & StrBuild
       objIniFile.Close
   Else
       GetNetworkPaperCutVersion = "0.0.0.0"
   End If
End Function

' Bitwise left shift
Function Lsh(ByVal N, ByVal Bits)
 Lsh = N * (2 ^ Bits)
End Function

' Returns a version string "a.b.c.d" as a two-element numeric
' array. The first array element is the most significant 32 bits,
' and the second element is the least significant 32 bits.
Function GetVersionStringAsArray(ByVal Version)
 Dim VersionAll, VersionParts, N
 VersionAll = Array(0, 0, 0, 0)
 VersionParts = Split(Version, ".")
 For N = 0 To UBound(VersionParts)
   VersionAll(N) = CLng(VersionParts(N))
 Next

 Dim Hi, Lo
 Hi = Lsh(VersionAll(0), 16) + VersionAll(1)
 Lo = Lsh(VersionAll(2), 16) + VersionAll(3)

 GetVersionStringAsArray = Array(Hi, Lo)
End Function

' Compares two versions "a.b.c.d". If Version1 < Version2,
' returns -1. If Version1 = Version2, returns 0.
' If Version1 > Version2, returns 1.
Function CompareVersions(ByVal Version1, ByVal Version2)
 Dim Ver1, Ver2, Result
 Ver1 = GetVersionStringAsArray(Version1)
 Ver2 = GetVersionStringAsArray(Version2)
 If Ver1(0) < Ver2(0) Then
   Result = -1
 ElseIf Ver1(0) = Ver2(0) Then
   If Ver1(1) < Ver2(1) Then
     Result = -1
   ElseIf Ver1(1) = Ver2(1) Then
     Result = 0
   Else
     Result = 1
   End If
 Else
   Result = 1
 End If
 CompareVersions = Result
End Function

 

In theory, you only need to change the first line of the script to point to your server path i.e. set PapercutPath and ClientArguments (if you want to do something fancy)

 

2nd disclaimer, some of the version check code, I pulled from google so it's not all mine.

Edited by minimoo
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...