Re: VBScripting, need a little help
- From: "Santos Soler" <soler_s@xxxxxxxxxxx>
- Date: Mon, 28 Nov 2005 23:35:47 -0500
Try it this way:
WshShell.Run ("net time /domain:your-domain-name-here /set /y", 0, TRUE)
"AFisher" <AFisher@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:927860FA-F3F1-4774-8991-5CD2F9B39761@xxxxxxxxxxxxxxxx
>I to don't understand why the calls to the shell are not working, I can
>type
> them directly at a command prompt as any of the users and get the desired
> results, how ever the VBscript calls fail, I get a sec or 2 splash of the
> cmd
> shell, but nothing is connected or updated.
>
> I'm not tied to using net time, how ever I have not been able to find any
> other way to force time synchs in VBScript, I can detect the local time,
> date, but I can not synch it with a time server. Both my firewall and My
> switchs/routers run the NTP service and I have as of yet been unable to
> synch
> with them, or any other NTP services local or Inet
>
>
> "SubnetJO" wrote:
>
>> OK.
>> I didn't understand WHY the attempt to map the user "HomeDir" should not
>> work.
>> If on "server" a share named "username$" exists, (the user have the
>> correct
>> privileges), it works.
>> I cannot see the problem.
>>
>> About the shell, try substitutig the paramenter "5" whit "0" in the last
>> line.
>> WshShell.Run strCmd, 5, True
>> That parameter will not show you the command window (but you still run
>> the
>> cmd).
>>
>> If you want to use the net.exe tool to synch, you have no choice, you
>> have
>> to run that tool... ;-)
>>
>> But...
>> Why don't you use the embedded W32time service?
>> The clock will be automatically configured with domain controllers. You
>> may
>> set-up a NTP achitecture, if you need.
>>
>> And more... be careful about time synch!
>> Try a more robust architecture than simply logon scripts.
>> Kerberos is depending on time... if you have not a very sharply
>> network-wide
>> synchronized time, you may receive an reply to a your email message, one
>> minute BEFORE you sent the message!!! (happened to me).
>>
>> Bye,
>> SubnetJO, Italy
>>
>>
>>
>> "AFisher" ha scritto:
>>
>> > below is a copy of my current Login script, I map Drives and Printers
>> > during
>> > login based on user groups, however I ahve to problems;
>> > 1) I would like to map the home dir as well in the same manor as the
>> > other
>> > mappings.
>> > 2) I would like to time synch with the domain via VB with out calling
>> > out to
>> > a Dos Shell.
>> >
>> >
>> >
>> > '**********************************************************************************
>> > ' Set Environment Variables
>> > '*********************************************************************************
>> > Set WSHNetwork = WScript.CreateObject("WScript.Network")
>> > Set WSHShell = WScript.CreateObject("WScript.Shell")
>> >
>> > On Error Resume Next
>> >
>> > Domain = WSHNetwork.UserDomain
>> > UserName = ""
>> >
>> > While UserName = ""
>> > UserName = WSHNetwork.UserName
>> > MyGroups = GetGroups(Domain, UserName)
>> > Wend
>> >
>> > '*********************************************************************************
>> > ' Main Process:
>> > '*********************************************************************************
>> > GrpMeb UserName
>> > ShowBox
>> >
>> > WScript.Quit
>> >
>> > '*********************************************************************************
>> > 'Function: GetGroups
>> > '*********************************************************************************
>> > Function GetGroups(Domain, UserName)
>> > Set objUser = GetObject("WinNT://" & Domain & "/" & UserName)
>> > GetGroups=""
>> > For Each objGroup In objUser.Groups
>> > GetGroups=GetGroups & "[" & UCase(objGroup.Name) & "]"
>> > Next
>> > End Function
>> >
>> > '********************************************************************************
>> > 'Function: InGroup
>> > '********************************************************************************
>> > Function InGroup(strGroup)
>> > InGroup=False
>> > If InStr(MyGroups,"[" & UCase(strGroup) & "]") Then
>> > InGroup=True
>> > End If
>> > End Function
>> >
>> > '*********************************************************************************
>> > ' MapDrives Subroutine
>> > '*********************************************************************************
>> > Sub MapDrive(sDrive,sShare)
>> > On Error Resume Next
>> > WSHNetwork.RemoveNetworkDrive sDrive, 1, 1
>> > WScript.sleep 1000
>> > Err.Clear
>> > WSHNetwork.MapNetworkDrive sDrive,sShare
>> > End Sub
>> >
>> > '********************************************************************************
>> > 'Map Drives:
>> > '********************************************************************************
>> > Sub GrpMeb(UNAME)
>> > If INGROUP ("mirus drive") Then
>> > MapDrive "s:", "\\ServerName\mirusfiles"
>> > End If
>> > If INGROUP ("dataentry") Then
>> > MapDrive "T:", "\\ServerName\dp\9546\ifiles"
>> > End If
>> > If INGROUP ("monsoft") Then
>> > MapDrive "m:", "\\ServerName\monsof$"
>> > End If
>> > If INGROUP ("om f-drive") Then
>> > MapDrive "G:", "\\ServerName\g_drive"
>> > End If
>> > If INGROUP ("om e-drive") Then
>> > MapDrive "J:", "\\ServerName\j-drive"
>> > End If
>> > If INGROUP ("dp Drives") Then
>> > MapDrive "h:", "\\ServerName\ftp$"
>> > End If
>> > If INGROUP ("DP drives") Then
>> > MapDrive "G:", "\\ServerName\g_drive"
>> > End If
>> > If INGROUP ("DP Drives") Then
>> > MapDrive "j:", "\\ServerName\j-drive"
>> > End If
>> > If INGROUP ("dpshare1") Then
>> > MapDrive "p:", "\\ServerName\dpshare1"
>> > End If
>> > If INGROUP ("DP Tdrive") Then
>> > MapDrive "T:", "\\ServerName\dp"
>> > End If
>> > If INGROUP ("Act_Users") Then
>> > MapDrive "W:", "\\ServerName\act$"
>> > End If
>> > If INGROUP ("Log_share") Then
>> > MapDrive "l:", "\\ServerName\logs$"
>> > End If
>> > If INGROUP ("INV") Then
>> > MapDrive "Q:", "\\ServerName\wmspub"
>> > End If
>> > If INGROUP ("E2_Users") Then
>> > MapDrive "U:", "\\ServerName\e2_database"
>> > End If
>> > If INGROUP ("Eric") Then
>> > MapDrive "W:", "\\ServerName\eric_bght$"
>> > End If
>> >
>> > 'This line is an attempt to map the Z: to user's Home dire
>> > MapDrive "Z:", "\\ServerName\" & UserName &"$"
>> >
>> >
>> > If INGROUP ("Savin") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\savin"
>> > End If
>> > If INGROUP ("hp5si") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\hp5si"
>> > End If
>> > If INGROUP ("DP_1") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\DP_1"
>> > End If
>> > If INGROUP ("Prod_1") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\Prod_1"
>> > End If
>> > If INGROUP ("prod_2") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\Prod_2"
>> > End If
>> > If INGROUP ("7300dn") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\Prod_3"
>> > End If
>> > If INGROUP ("7300dn") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\Prod_4"
>> > End If
>> > If INGROUP ("hp2200") Then
>> > WSHNetwork.AddWindowsPrinterConnection "\\ServerName\hp2200"
>> > End If
>> > On Error Resume Next
>> > WSHNetwork.RemoveNetworkDrive "z:"
>> > Err.Clear
>> >
>> > 'This is where I would like to have VB code so I have No dos shell
>> > commands,
>> > is this posable?
>> > strCmd = "net.exe use z: /home"
>> > WshShell.Run strCmd, 5, True
>> > strCmd = "net.exe time \\ServerName /set /yes"
>> > WshShell.Run strCmd, 5, True
>> > End Sub
.
- References:
- VBScripting, need a little help
- From: AFisher
- RE: VBScripting, need a little help
- From: SubnetJO
- RE: VBScripting, need a little help
- From: AFisher
- VBScripting, need a little help
- Prev by Date: formula to calculate kb to mb
- Next by Date: Re: WScript to modify GPO
- Previous by thread: RE: VBScripting, need a little help
- Next by thread: RE: VBScripting, need a little help
- Index(es):
Relevant Pages
|
Loading