ozraelised
Getting the hang of it
Registered: 2002-12-02
Posts: 59
Loc: Albury
|
Hi Guys
45 days gone since I run the Script and this morning I got it again. Excellent. The only problem is that the mapdrive didn't come up only the K drive and the Z drive. The K drive is mapped from the user profile, I don't understand why a script that worked before and with no changes will not work. this is the code: Break Off Dim $SO, $Pause $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('WrapAtEOL','On')
Dim $SetCounter, $Key, $KeyValue, $Delay, $RC, $Answer, $Msg $Delay=3888000 $SetCounter=FlipcTime(@DATE,@TIME) $Key=KeyExist('HKCU\Software\LogOnScripts\Schedule\45') If $Key $KeyValue=Val(ReadValue('HKCU\Software\LogOnScripts\Schedule\45','time')) If $SetCounter > ($KeyValue+$Delay) ; Reset the counter to current time so you can check properly next time $KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ) $Answer=MessageBox('You must agree that Ozz is the man or you will be logged off','Reminder',4164) If $Answer=7 $Msg=MessageBox('Since you chose NO you must be logged off now','Goodbye now 1st',4144) $RC=LogOff(1) Else $Msg=MessageBox('Thank you for agreeing with me. You may continue now..1st.','Ozz is the man',4160,5) EndIf EndIf Else $KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ) $Answer=MessageBox('You must agree that Ozz is the man or you will be logged off 2nd','Reminder',4164) If $Answer=7 $Msg=MessageBox('Since you chose NO you must be logged off now','Goodbye now 2nd',4144) $RC=LogOff(1) Else $Msg=MessageBox('Thank you for agreeing with me. You may continue now..2nd.','Ozz is the man',4160) EndIf Endif
If InGroup ('Domain Users') MapDrive ('F:','jmmes', 'Vol1') MapDrive ('G:', 'jmmes', 'mCalas') MapDrive ('H:', 'jmmes', 'caldata') MapDrive ('I:', 'jmmes', 's6system') MapDrive ('J:', 'jmmes', 'winapp') ; K: Drive Mapped by OS as Home Share MapDrive ('L:', 'jmmes', 'abas') MapDrive ('M:', 'jmmes', 'vol1') MapDrive ('N:', 'jmmes', 'netapps') MapDrive ('O:', 'jmmes', 'JMME-FPlan') MapDrive ('P:', 'jmmes', 'apps') MapDrive ('Q:', 'jmmes', 'NotesMME') MapDrive ('S:', 'jmmes', 'vol2') MapDrive ('T:', 'jmmes', 'templates') MapDrive ('Y:', 'jmmes', 'PWCDll') Endif
Quit 1
Function FlipcTime($date,$time,optional $tz) Dim $y,$m,$d $date = Split($date,"/") If UBound($date) <> 2 Exit(1) EndIf $y=Val($date[0]) $m=Val($date[1]) $d=Val($date[2]) If $m<3 $m=$m+12 $y=$y-1 EndIf $Date=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306 $time = Split($time,":") Select Case UBound($time)=1 ReDim PreServe $time[2] $time[2]=0 Case UBound($time)=2 Case 1 Exit(1) EndSelect $time = (Val($time[0])*3600)+(Val($time[1])*60)+Val($time[2]) $flipctime = IIF($tz,(($date-719163)*86400 + $time)-($tz*3600),($date-719163)*86400 + $time) EndFunction
Function MapDrive($Drive,$Server,$Share) Dim $Drive, $Server, $Share, $Shell Color c+/n If $Drive<>"" And $Server<>"" And $Share<>"" $LogText="Connecting " + $Drive + " to \\" + $Server + "\" + $Share ? $LogText USE $Drive /Delete /Persistent USE $Drive "\\"+$Server+"\"+$Share If @ERROR=0 Color g+/n $x=" - Success" $x If Val($DOS) >= 5 $shell=CreateObject("shell.application") $shell.NameSpace($Drive+"\").Self.Name=$Share + " on '" + $Server + "'" $shell = 0 EndIf Else Color r+/n $x=" - Failed: Error " + @ERROR $x $ErrorState=1 EndIf Color w+/n Else Endif Endfunction
|