Jump to content

WTF -MS VS 2005 kills rpinter script?


Recommended Posts

Posted

Ok I realise the title makes no logical sense what so ever but I'm sitting here looking at the problem and thats the only way to describe it. A little Background.

 

This year we had to add some more licenses to allow larger classes to use visual basic in computing classes. Obviosuly VB6 is defunct as far as MS is concerned but they agreed to upgrade our VB6 licenses to VS2005 and add more VS2005 licenses. Upgrades are a pain cos learning resources will be made obsolete but it can't be helped. We got our VS2005 license I installed all the prereqs from GPO, .net2, MSXML (the whole kitchen sink) used the admin installer to make a mst file for our needs and deployed it by GPO. That shoulda been it just some adjustment needed from Pupils and staff to the new menus etc.

 

Today I got a report that somone couldn't print. I looked on they're account no printers. I logged in myself no printers.

 

I use a user login script that I got from here to assign printers.

 

Set oNet=wscript.createobject("wscript.network")
Set objSysInfo = CreateObject("ADSystemInfo")
Set AllPrinters = oNet.EnumPrinterConnections

On Error Resume Next
For i = 0 to AllPrinters.Count -1 Step 2
oNet.RemovePrinterConnection AllPrinters.Item(i+1), true 
Next

strComputerDN = objSysInfo.ComputerName
comp=Parse(strComputerDN)
'Wscript.Echo Comp
Function Parse(strDN)
Parse = Mid(strDN, InStr(strDN, "=") + 1)
Parse = Mid(Parse, InStr(Parse, "=") + 1)
Parse = MId(Parse, 1, InStr(Parse, "=") - 4)
End Function

Select Case Comp
Case "R214"
strPrinter="\\Server2\R214-Laser1"
strprinter2="\\Server2\R214-ColourLaser"

...........

End select

If strPrinter <> "" Then
oNet.AddWindowsPrinterconnection strPrinter
oNet.SetDefaultPrinter strPrinter
End If
If strPrinter2 <> "" Then
oNet.AddWindowsPrinterconnection strPrinter2
End If
If strPrinter3 <> "" Then
onet.AddWindowsPrinterconnection strPrinter3
End If

 

It worked on these machines before VS2005 and still works in the rest of the school so its got to be related.

 

Even if I run the script from my desktop with an admin account it just appears to not execute. Anyone any ideas? There is nothin helpful in event log etc.

Posted

Are other VB scripts able to run?

Just a thought as another NM of mine had to adjust one of the GPOs to allow due to an upgrade on one of the service packs for the servers (2k3r2).

Posted

Ok I think I've got it. At least ona test machine.

 

*.vbs still had a VBscript icon but it seemed it had lost its association with wscript host. It wasn't opening in VS2005 and it wasn't popping up a "what program should I use" prompt. It was just doin nothing.

 

Gonna try the rest of the room and cross my fingers.

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...