{
	"id": "cbdd1722-e72a-4cef-a39a-9b223ff27a77",
	"created_at": "2026-04-06T00:16:24.811761Z",
	"updated_at": "2026-04-10T03:20:05.909567Z",
	"deleted_at": null,
	"sha1_hash": "a213bb1f08c583869f5ffd52e5c89f0569744c63",
	"title": "Creating logon scripts: Scripting; General",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 55383,
	"plain_text": "Creating logon scripts: Scripting; General\r\nBy Archiveddocs\r\nArchived: 2026-04-05 23:19:25 UTC\r\nApplies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server\r\n2003 with SP2\r\nYou can use logon scripts to assign tasks that will be performed when a user logs on to a particular computer. The\r\nscripts can carry out operating system commands, set system environment variables, and call other scripts or\r\nexecutable programs. The Windows Server 2003 family supports two scripting environments: the command\r\nprocessor runs files containing batch language commands, and Windows Script Host (WSH) runs files containing\r\nMicrosoft Visual Basic Scripting Edition (VBScript) or Jscript commands. You can use a text editor to create\r\nlogon scripts. Some tasks commonly performed by logon scripts include:\r\nMapping network drives.\r\nInstalling and setting a user's default printer.\r\nCollecting computer system information.\r\nUpdating virus signatures.\r\nUpdating software.\r\nThe following example logon script contains VBScript commands that use Active Directory Service Interfaces\r\n(ADSI) to perform three common tasks based on a user's group membership:\r\n1. It maps the H: drive to the home directory of the user by calling the WSH Network object's\r\nMapNetworkDrive method in combination with the WSH Network object's UserName property.\r\n2. It uses the ADSI IADsADSystemInfo object to obtain the current user's distinguished name, which in turn\r\nis used to connect to the corresponding user object in Active Directory. Once the connection is established,\r\nthe list of groups the user is a member of is retrieved by using the user's memberOf attribute. The\r\nmultivalued list of group names is joined into a single string by using VBScript's Join function to make it\r\neasier to search for target group names.\r\n3. If the current user is a member of one of the three groups defined at the top of the script, then the script\r\nmaps the user's G: drive to the group shared drive, and sets the user's default printer to be the group printer.\r\n1. Open Notepad.\r\n2. Copy and paste, or type, the following:\r\nhttps://technet.microsoft.com/en-us/library/cc758918(v=ws.10).aspx\r\nPage 1 of 3\n\nConst ENGINEERING_GROUP = \"cn=engineering\"\r\nConst FINANCE_GROUP = \"cn=finance\"\r\nConst HUMAN_RESOURCES_GROUP = \"cn=human resources\"\r\nSet wshNetwork = CreateObject(\"WScript.Network\")\r\nwshNetwork.MapNetworkDrive \"h:\",\r\n\"\\\\FileServer\\Users\\\" \u0026 wshNetwork.UserName\r\nSet ADSysInfo = CreateObject(\"ADSystemInfo\")\r\nSet CurrentUser = GetObject(\"LDAP://\" \u0026\r\nADSysInfo.UserName)\r\nstrGroups = LCase(Join(CurrentUser.MemberOf))\r\nIf InStr(strGroups, ENGINEERING_GROUP) Then\r\n wshNetwork.MapNetworkDrive \"g:\",\r\n \"\\\\FileServer\\Engineering\\\"\r\n wshNetwork.AddWindowsPrinterConnection\r\n \"\\\\PrintServer\\EngLaser\"\r\n wshNetwork.AddWindowsPrinterConnection\r\n \"\\\\PrintServer\\Plotter\"\r\n wshNetWork.SetDefaultPrinter\r\n \"\\\\PrintServer\\EngLaser\"\r\nElseIf InStr(strGroups, FINANCE_GROUP) Then\r\n wshNetwork.MapNetworkDrive \"g:\",\r\n \"\\\\FileServer\\Finance\\\"\r\n wshNetwork.AddWindowsPrinterConnection\r\n \"\\\\PrintServer\\FinLaser\"\r\n wshNetWork.SetDefaultPrinter\r\n \"\\\\PrintServer\\FinLaser\"\r\nElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then\r\n wshNetwork.MapNetworkDrive \"g:\",\r\n \"\\\\FileServer\\Human Resources\\\"\r\n wshNetwork.AddWindowsPrinterConnection\r\n \"\\\\PrintServer\\HrLaser\"\r\n wshNetWork.SetDefaultPrinter\r\n \"\\\\PrintServer\\HrLaser\"\r\nEnd If\r\n3. On the File menu, click Save As.\r\nhttps://technet.microsoft.com/en-us/library/cc758918(v=ws.10).aspx\r\nPage 2 of 3\n\n4. In Save in, click the directory that corresponds to the domain controller's Netlogon shared folder (usually\r\nSystemRoot\\SYSVOL\\Sysvol\\DomainName\\Scripts where DomainName is the domain's fully qualified\r\ndomain name).\r\n5. In Save as type, click All Files.\r\n6. In File name, type a file name, followed by .vbs, and then click Save. WSH uses the .vbs extension to\r\nidentify files that contain VBScript commands.\r\nNotes\r\nTo open Notepad, click Start, point to All programs, point to Accessories, and then click Notepad.\r\nTo use the example logon script, you need to change the group names, network drive letters, and Universal\r\nNaming Convention (UNC) paths to match your system environment.\r\nTo run a logon script, you need to assign the script to a user or a group. For more information, see Assign a\r\nlogon script to a user or group.\r\nFor more information about creating and using logon scripts, see Logon Scripts, Windows Script at the Microsoft\r\nWeb site, and the Microsoft Windows Resource Kits Web site.\r\nYour server might function differently based on the version and edition of the operating system that is\r\ninstalled, your account permissions, and your menu settings. For more information, see Viewing Help on\r\nthe Web.\r\nSource: https://technet.microsoft.com/en-us/library/cc758918(v=ws.10).aspx\r\nhttps://technet.microsoft.com/en-us/library/cc758918(v=ws.10).aspx\r\nPage 3 of 3",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"references": [
		"https://technet.microsoft.com/en-us/library/cc758918(v=ws.10).aspx"
	],
	"report_names": [
		"cc758918(v=ws.10).aspx"
	],
	"threat_actors": [],
	"ts_created_at": 1775434584,
	"ts_updated_at": 1775791205,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/a213bb1f08c583869f5ffd52e5c89f0569744c63.pdf",
		"text": "https://archive.orkl.eu/a213bb1f08c583869f5ffd52e5c89f0569744c63.txt",
		"img": "https://archive.orkl.eu/a213bb1f08c583869f5ffd52e5c89f0569744c63.jpg"
	}
}