[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problem running computer logon script from netlogon share

Posted on 2009-04-28
3
Medium Priority
?
1,853 Views
Last Modified: 2012-05-06
I have a computer logon script (under admin templates/System/Logon) that is a simple vb script to rename my computer. Code attached.

It runs fine if I enter the path as \\server1\netlogon\script.vbs.

If I enter the path as \\domain.local\netlogon\script.vbs, users are prompted to run the script.

I'd like to resolve this because I don't like having to reconfigure (or at least check) GPOs whenever a DC is demoted.
Const MY_COMPUTER = &H11&
 
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER) 
Set objFolderItem = objFolder.Self
objFolderItem.Name = "My Computer " & strComputer

Open in new window

0
Comment
Question by:jonhicks
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 1500 total points
ID: 24248736
The users are probably prompted because "domain.local" isn't recognized as Local Intranet in the security settings of IE.
There's an easy solution: use %Logonserver% instead of "\\server1" (%LogonServer% DOES include the two leading backslashes); %LogonServer% contains the DC which just authenticated the user, so in all likelihood, it's running ...
%LogonServer%\netlogon\script.vbs
0
 
LVL 4

Author Comment

by:jonhicks
ID: 24250400
Yup, you're right. If I use windows explorer and browse to \\server1\netlogon\ and launch the script, it runs without a warning. If I run it from \\domain.local\netlogon, it throws up the security warning.

If I add file://*domain.local to the local Intranet zone in IE, it works without the warning.

I tried setting the script path as %logonserver%\netlogon\script.vbs but it didn't run. Not sure if you can only call this variable from inside a script? Nothing in the event log.
0
 
LVL 4

Author Comment

by:jonhicks
ID: 24259588
Resolved the problem by running a computer startup script to add file://*.domain.local to the Local Intranet zone.

computer logon scripts run from \\domain.local\netlogon now run without a security warning.

Odd that this only affected computer logon scripts and not user logon scripts (which run fine without a warning).
On Error Resume Next
 
Const HKEY_LOCAL_MACHINE = &H80000002
 
strComputer = "."
Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
    & "ZoneMap\Domains\domain.local"
 
objReg.CreateKey HKEY_LOCAL_MACHINE, strKeyPath
 
strValueName = "file"
dwValue = 1
 
objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question