Home » Script Builder - Script Builder - Bugs » Compiled script will not output Messages in this topic - RSS
|
4/28/2009 3:46:56 AM
broddyfi
broddyfi
Posts 5
Hi there

I don't know if this is a bug or me doing something wrong (the latter I suspect!), but the script I have created will not output to anywhere, it just keeps saying "access to the path <<path>> is denied" I am using the combined script box. I am logged on as an administrator domain\local. Any ideas as to what is wrong?

Cheers
edited by broddyfi on 4/29/2009
5/9/2009 4:03:19 PM
Techie_4Life
Techie_4Life
Posts 5
Where did you set the paths for the sub scripts and the combined script? Do you have permissions to that folder and files there?
5/10/2009 8:52:05 AM
broddyfi
broddyfi
Posts 5
Hi Techie_4life

All the output boxes are pointing to the root of C:\ and permissions are set for full access for the account i'm using, which why i don't understand the access is denied message. Have you any suggestions? I have tried various locations and all keep saying access denied!

cheers
5/12/2009 8:29:51 AM
Techie_4Life
Techie_4Life
Posts 5
Can you give me your script, minus server names if you want, so that I can see where things went wrong? Is the script solely made using script builder? Is it your custom section that is giving you problems? Did you debug your script to make sure nothing is wrong? Are there any machines this does work on?

Just trying to get some more info here to troubleshoot this.
5/13/2009 12:39:23 AM
broddyfi
broddyfi
Posts 5
Hi Techie_4Life

This script is made solely by the script builder and there are is no custom section. I have tried on various machines to get this to output to no avail. This script just maps printers and network drives for a group of users. Here it is:

'~~~~~~~~~~~~~~ Script Header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OPTION EXPLICIT
ON ERROR RESUME NEXT
DIM objNetwork, objFSO
DIM ComputerName, UserName
SET objNetwork = CreateObject("Wscript.Network")
SET objFSO = CreateObject("Scripting.FileSystemObject")
ComputerName = objNetwork.ComputerName
UserName = UCASE(objNetwork.UserName)

'~~~~~~~~~~~~~~ Script Body ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

IF IsMember("STAFF") THEN
AddPrinter "\\servername\Brother 5250 DN", False
AddPrinter "\\servername\BroHL1240", False
AddPrinter "\\servername\KONIMono", False
MapDrive "P:", "\\servername\pupils$"
MapDrive "I:", "\\servername\dfs\apps"
MapDrive "T:", "\\servername\pool"
END IF



'~~~~~~~~~~~~~~ Built-in Functions ~~~~~~~~~~~~~~~~~~~~~~~

Function EndsWith(ByVal str1, ByVal str2)

If Len(str2) > Len(str1) Then
EndsWith = False
Else
If Mid(str1, Len(str1) - Len(str2) + 1, Len(str2)) = str2 Then
EndsWith = True
Else
EndsWith = False
End If
End If

End Function

Function BeginsWith(ByVal str1, ByVal str2)

If Mid(str1, 1, Len(str2)) = str2 Then
BeginsWith = True
Else
BeginsWith = False
End If

End Function

Function IsMember(Byval groupName)

DIM domain, blnIsMember
DIM objUser, grp

domain = objNetwork.UserDomain
blnIsMember = False
SET objUser = GetObject("WinNT://" & domain & "/" & UserName & ",user")
For Each grp In objUser.Groups
If LCASE(grp.Name) = LCASE(groupName) Then
blnIsMember = True
Exit For
End If
Next
IsMember = blnIsMember

End Function

Function MapDrive(Byval Drive, Byval Path)

If Not objFSO.DriveExists(Drive) Then
objNetwork.MapNetworkDrive Drive, Path
End If

End Function

Function AddPrinter(Byval PrintServer, Byval Default)

objNetwork.AddWindowsPrinterConnection(PrintServer)
IF Default THEN
objNetwork.SetDefaultPrinter PrintServer
End If

End Function

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks again for your help
5/13/2009 7:29:02 AM
Techie_4Life
Techie_4Life
Posts 5
Hmm, yeah the script is a standard generated one from SB. So what output are you looking for; because the script should not have any output just results of the printers and drives being mapped? are you trying to run the script manually or are you going to a machine and logging on? Since this is supposed to be a logon script I assume then you should have the script in the the \\%logongserver%\Netlogon\ folder as this is the default location of where logon scripts are executed. Then in AD you type the name of the script, i.e. Logon.vbs in the Account tab => User Profile section => Logon Script field. Not saying you don't know this just clarifying things. When the user logs on then the script will be launched from the LogonServer locally on the machine and executed.

Hopefully we can resolve this soon. I just finished making new printer and drive mappings using SB last night. Took for ever to go through all the group logic to make sure things meshed with my current POS batch file logon scripts. It does work though and it should work even if you just double click the file from your computer since the script pulls the necessary paths in the functions section.
5/18/2009 12:42:29 AM
broddyfi
broddyfi
Posts 5
Yeah strange ain't it? I chose C: because of the issue I have raised, as I assumed it was a permissions problem with the netlogon folder. Though I have checked again and all permissions are correct. I guess I could just copy the code from the preview and save that, that should work?
5/18/2009 6:31:57 AM
Techie_4Life
Techie_4Life
Posts 5
so the test account you are running the script with is has domain admin level permissions, or just an account that has been given permissions? Where are you seeing this output of access denied? Is that because you run it as a cscript and the cmd prompt tells you this? I might be having a similar problem. I tested my script out and it worked fine on my admin account, but regular users would not get their printers mapped... hmmm, I wonder if this has to do with permissions as well. I just don't know where yet. I'm going to look at my scripts today and I'll try running yours (with my server names in there) to see if it works on my end.
5/18/2009 7:29:52 AM
broddyfi
broddyfi
Posts 5
I have not got to the point of testing the script. The access denied message is generated by SB. I have not tried it with a test account yet. I am logged in as administrator (the built in account) so permissions should not be an issue anyway. The problem is when i try to build the script instead of creating a script file it gives the error message.
pages: 1
|

Home » Script Builder - Script Builder - Bugs » Compiled script will not output