 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Group Policy and Logon Script troubles</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/group-policy-and-logon-script-troubles/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/group-policy-and-logon-script-troubles/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 16:11:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: noid10t</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/group-policy-and-logon-script-troubles/#comment-36735</link>
		<dc:creator>noid10t</dc:creator>
		<pubDate>Wed, 12 Jul 2006 08:16:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-36735</guid>
		<description><![CDATA[SBS 2003 this is the DC, Win2000 clients (will be updated to winxp next fiscal year)just 2 PCs right now until I get it working, standard TCP/IP over ethernet, Just simple domain, no forest structure, I added our OU, put in the security groups under that, and added the users making them members of the appropriate security group. Here&#039;s a copy of the logon script I used. This is the logon script from my day job. I modified it to suit the needs of this side job. Meaning, they only have one network printer to map, and only 2 network drives. One drive everyone is allowed to see, the other one is based on the security group they belong to. Here it is....
Dim objNet, strInitial, net, FSO, strUserName, strUserDomain, ObjGroupDict, WSHNetwork, UNCpath1
Set WSHNetwork = WScript.CreateObject(&quot;WScript.Network&quot;)
Set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
on error resume next
Set objNet = CreateObject(&quot;Wscript.Network&quot;)
strUserName =objNet.UserName
strUserDomain = WSHNetwork.UserDomain
Set net = CreateObject(&quot;WScript.Network&quot;)
Set ObjGroupDict = CreateMemberOfObject(strUserDomain, strUserName)

Const MY_COMPUTER = &amp;H11&amp;

Set objNetwork = CreateObject(&quot;Wscript.Network&quot;)
strComputer = objNetwork.ComputerName
Set objShell = CreateObject(&quot;Shell.Application&quot;)
Set objFolder = objShell.Namespace(MY_COMPUTER) 
Set objFolderItem = objFolder.Self
objFolderItem.Name = strComputer


If MemberOf(ObjGroupDict, &quot;MIS Department&quot;) Then 
WSHNetwork.MapNetworkDrive &quot;Z:&quot;, &quot;anchorMIS&quot;
net.AddWindowsPrinterConnection &quot;Waufile01MIS4200&quot;
net.AddWindowsPrinterConnection &quot;Waufile01AdminCpyPrt&quot;
net.AddWindowsPrinterConnection &quot;Waufile01AdminCpyColorPCL5c&quot;
End If


If MemberOf(ObjGroupDict, &quot;Marketing&quot;) Then 
WSHNetwork.MapNetworkDrive &quot;M:&quot;, &quot;lambdaMarketing&quot;
net.AddWindowsPrinterConnection &quot;waufile01Marketing HP 9500&quot;
End If


If MemberOf(ObjGroupDict, &quot;Human Resources&quot;) Then 
net.AddWindowsPrinterConnection &quot;Waufile01HR HP 7140&quot;
End If


If MemberOf(ObjGroupDict, &quot;Accounting&quot;) Then
net.AddWindowsPrinterConnection &quot;Waufile01Acct-Epson-1520&quot;
End If


If MemberOf(ObjGroupDict, &quot;Construction&quot;) Then
net.AddWindowsPrinterConnection &quot;Waufile01ConstHP4&quot;
End If

If MemberOf(ObjGroupDict, &quot;Cashiers&quot;) Then
net.AddWindowsPrinterConnection &quot;Waufile01Cashiers-LaserJet3020PCL5e&quot;
End If

If MemberOf(ObjGroupDict, &quot;Transportation Printer&quot;) Then
net.AddWindowsPrinterConnection &quot;Waufile01TransportationShop - LaserJet 1320&quot;
End If


If MemberOf(ObjGroupDict, &quot;Engineering Printers&quot;) Then
net.AddWindowsPrinterConnection &quot;Waufile01Engineering Color LJ 8500&quot;
net.AddWindowsPrinterConnection &quot;Waufile01Engineering HP DesignJet 1055CM&quot;
net.AddWindowsPrinterConnection &quot;Waufile01EngPlotter-HPDJ4000ps-LineDrawings&quot;
net.AddWindowsPrinterConnection &quot;Waufile01EngPlotter-HPDJ4000ps-Images-Photos&quot;
End If


WSHNetwork.MapNetworkDrive &quot;U:&quot;, &quot;Waufile01Users&quot; &amp; strUserName
WSHNetwork.MapNetworkDrive &quot;P:&quot;, &quot;Waufile01Departments&quot;
WSHNetwork.MapNetworkDrive &quot;S:&quot;, &quot;anchorSoftware Installs&quot;
net.AddWindowsPrinterConnection &quot;Waufile01Manatee - LaserJet Printer&quot;
net.AddWindowsPrinterConnection &quot;Waufile01MemberServices - LaserJet 1320&quot;
net.AddWindowsPrinterConnection &quot;Waufile01Dispatch - LaserJet Printer&quot;
net.AddWindowsPrinterConnection &quot;Waufile01ILE LaserJet Printer&quot;

WSCript.Quit


Function MemberOf(ObjDict, strKey)
MemberOf = CBool(ObjGroupDict.Exists(strKey))
End Function

Function CreateMemberOfObject(strDomain, strUserName)
Dim objUser, objGroup
Set CreateMemberOfObject = CreateObject(&quot;Scripting.Dictionary&quot;)
CreateMemberOfObject.CompareMode = vbTextCompare
Set objUser = GetObject(&quot;WinNT://&quot;&amp;strDomain&amp;&quot;/&quot;&amp;strUserName&amp;&quot;,user&quot;)
For Each objGroup In objUser.Groups
CreateMemberOfObject.Add objGroup.Name, &quot;-&quot;
Next
Set objUser = Nothing
End Function

Thanks,
Mike]]></description>
		<content:encoded><![CDATA[<p>SBS 2003 this is the DC, Win2000 clients (will be updated to winxp next fiscal year)just 2 PCs right now until I get it working, standard TCP/IP over ethernet, Just simple domain, no forest structure, I added our OU, put in the security groups under that, and added the users making them members of the appropriate security group. Here&#8217;s a copy of the logon script I used. This is the logon script from my day job. I modified it to suit the needs of this side job. Meaning, they only have one network printer to map, and only 2 network drives. One drive everyone is allowed to see, the other one is based on the security group they belong to. Here it is&#8230;.<br />
Dim objNet, strInitial, net, FSO, strUserName, strUserDomain, ObjGroupDict, WSHNetwork, UNCpath1<br />
Set WSHNetwork = WScript.CreateObject(&#8220;WScript.Network&#8221;)<br />
Set FSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
on error resume next<br />
Set objNet = CreateObject(&#8220;Wscript.Network&#8221;)<br />
strUserName =objNet.UserName<br />
strUserDomain = WSHNetwork.UserDomain<br />
Set net = CreateObject(&#8220;WScript.Network&#8221;)<br />
Set ObjGroupDict = CreateMemberOfObject(strUserDomain, strUserName)</p>
<p>Const MY_COMPUTER = &amp;H11&amp;</p>
<p>Set objNetwork = CreateObject(&#8220;Wscript.Network&#8221;)<br />
strComputer = objNetwork.ComputerName<br />
Set objShell = CreateObject(&#8220;Shell.Application&#8221;)<br />
Set objFolder = objShell.Namespace(MY_COMPUTER)<br />
Set objFolderItem = objFolder.Self<br />
objFolderItem.Name = strComputer</p>
<p>If MemberOf(ObjGroupDict, &#8220;MIS Department&#8221;) Then<br />
WSHNetwork.MapNetworkDrive &#8220;Z:&#8221;, &#8220;anchorMIS&#8221;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01MIS4200&#8243;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01AdminCpyPrt&#8221;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01AdminCpyColorPCL5c&#8221;<br />
End If</p>
<p>If MemberOf(ObjGroupDict, &#8220;Marketing&#8221;) Then<br />
WSHNetwork.MapNetworkDrive &#8220;M:&#8221;, &#8220;lambdaMarketing&#8221;<br />
net.AddWindowsPrinterConnection &#8220;waufile01Marketing HP 9500&#8243;<br />
End If</p>
<p>If MemberOf(ObjGroupDict, &#8220;Human Resources&#8221;) Then<br />
net.AddWindowsPrinterConnection &#8220;Waufile01HR HP 7140&#8243;<br />
End If</p>
<p>If MemberOf(ObjGroupDict, &#8220;Accounting&#8221;) Then<br />
net.AddWindowsPrinterConnection &#8220;Waufile01Acct-Epson-1520&#8243;<br />
End If</p>
<p>If MemberOf(ObjGroupDict, &#8220;Construction&#8221;) Then<br />
net.AddWindowsPrinterConnection &#8220;Waufile01ConstHP4&#8243;<br />
End If</p>
<p>If MemberOf(ObjGroupDict, &#8220;Cashiers&#8221;) Then<br />
net.AddWindowsPrinterConnection &#8220;Waufile01Cashiers-LaserJet3020PCL5e&#8221;<br />
End If</p>
<p>If MemberOf(ObjGroupDict, &#8220;Transportation Printer&#8221;) Then<br />
net.AddWindowsPrinterConnection &#8220;Waufile01TransportationShop &#8211; LaserJet 1320&#8243;<br />
End If</p>
<p>If MemberOf(ObjGroupDict, &#8220;Engineering Printers&#8221;) Then<br />
net.AddWindowsPrinterConnection &#8220;Waufile01Engineering Color LJ 8500&#8243;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01Engineering HP DesignJet 1055CM&#8221;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01EngPlotter-HPDJ4000ps-LineDrawings&#8221;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01EngPlotter-HPDJ4000ps-Images-Photos&#8221;<br />
End If</p>
<p>WSHNetwork.MapNetworkDrive &#8220;U:&#8221;, &#8220;Waufile01Users&#8221; &amp; strUserName<br />
WSHNetwork.MapNetworkDrive &#8220;P:&#8221;, &#8220;Waufile01Departments&#8221;<br />
WSHNetwork.MapNetworkDrive &#8220;S:&#8221;, &#8220;anchorSoftware Installs&#8221;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01Manatee &#8211; LaserJet Printer&#8221;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01MemberServices &#8211; LaserJet 1320&#8243;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01Dispatch &#8211; LaserJet Printer&#8221;<br />
net.AddWindowsPrinterConnection &#8220;Waufile01ILE LaserJet Printer&#8221;</p>
<p>WSCript.Quit</p>
<p>Function MemberOf(ObjDict, strKey)<br />
MemberOf = CBool(ObjGroupDict.Exists(strKey))<br />
End Function</p>
<p>Function CreateMemberOfObject(strDomain, strUserName)<br />
Dim objUser, objGroup<br />
Set CreateMemberOfObject = CreateObject(&#8220;Scripting.Dictionary&#8221;)<br />
CreateMemberOfObject.CompareMode = vbTextCompare<br />
Set objUser = GetObject(&#8220;WinNT://&#8221;&amp;strDomain&amp;&#8221;/&#8221;&amp;strUserName&amp;&#8221;,user&#8221;)<br />
For Each objGroup In objUser.Groups<br />
CreateMemberOfObject.Add objGroup.Name, &#8220;-&#8221;<br />
Next<br />
Set objUser = Nothing<br />
End Function</p>
<p>Thanks,<br />
Mike</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.020 seconds using memcached
Object Caching 267/273 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 16:23:41 -->