VPN Logonscript for domains


This article is meant for domain admins, and IT people looking for a method to have a VPN client invoke an end users log on script after they log on to the VPN.. If this is not you, then I’m not sure it will help.

Anyway. Since I could remember, VPN users have had the problem of hunting down their log on script and running it to map their drives, and whatever else needs to be done after logging on to the VPN. This is because if you log on to your computer from home, and you are not on the network, then your log on scripts wont run. Boo Hoo. I ran into the same issue, and decided to do something about it. I came up with some code snippets, added my own, tweaked it, polished it and created a VBS script (visual basic script, or VBScript) that will run the log on script after a user logs onto the VPN. This, however is not ordinary script. After it logs on to the VPN, it waits for 20 seconds, pings a server on your intranet (you have to set the IP) and if it can ping the server, it runs the script. If it CANT ping the server, it waits about 20 seconds and tries again. It does this 5 times, and after the 5th time, it stops and gives up.

The reason for the waiting and the Pinging is, if you are using the Cisco systems VPN Client, and choose Options > Application launcher, it launches that application as soon as you click Connect… However, after you hit connect, you are sometimes brought up to a username and password prompt, and sometimes have to agree to terms before connecting to the network. This takes more than 1 millisecond, to I thought 20 would do.  You would have to take this script, save it in a file, and call it vpn.vbs (or whatever name you want to choose as long as it ends in .vbs) and place it in your VPN application launcher as shown above.

The only thing you have to specify in this script is the IP address to ping, and make sure it is in your INTRANET not the INTERNET.. because this is how the script knows the connection was successful. Line 5 in the script is where you should change the IP.  This script will detect each users log on script, logon server etc…  

 Oh.. and one more thing…

 GET PERMISSION FROM YOUR HELPDESK OR NETWORK ADMIN BEFORE USING THIS IF YOU ARE NOT ON THE HELPDESK, OR A NETWORK ADMIN ALREADY!!!

 Ok… so on with the script:


Dim strHost,tries
wscript.sleep 10000
call main 'Script used from ForumUniversal.com  
function main ' Enjoy
strHost = "10.11.1.110"
if Ping(strHost) = True then
  call runlogonscript
Else
  tries = tries + 1
  call waitasec
end if
end function
Function Ping(strHost)
  dim objPing, objRetStatus
  set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
  ("select * from Win32_PingStatus where address = '" & strHost & "'")
  for each objRetStatus in objPing
  if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
  Ping = False
  else
  Ping = True
  end if
  next
End Function
function runlogonscript
strComputer = "."
  Dim objNet,runme,x
  Set objNet = CreateObject("WScript.NetWork")
  strUserName = objNet.UserDomain & "\" & objNet.UserName
  Set WshShell = WScript.CreateObject("WScript.Shell")
  Set objShell = CreateObject("Wscript.Shell")
  Set objEnv = objShell.Environment("process")
  strServer = objEnv("LOGONSERVER")
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
  Set objTranslator = CreateObject("NameTranslate")
  objTranslator.Init ADS_NAME_INITTYPE_GC, ""
  objTranslator.Set ADS_NAME_TYPE_NT4, strUserName
  strUserDN = objTranslator.Get(ADS_NAME_TYPE_1779)
Set objItem = GetObject("LDAP://" & strUserDN)
strscriptPath = objItem.Get("scriptPath")
Dim LogonScript
LogonScript = strServer & "\netlogon\" & strscriptPath
x = ("rundll32 url.dll,FileProtocolHandler " & LogonScript)
WshShell.run x
call goodquits
end function
function waitasec
if tries = 5 then
call quits
else
wscript.sleep 20
wscript.sleep 10000
call main
end if
end function
function quits
end function
Function goodquits
end function

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon



Telnet Fun… (UPDATED)


  1. click start
  2. click run
  3. erase whatever is in there
  4. type this in’   telnet towel.blinkenlights.nl    ‘   without the quotes
  5. hit enter
  6. sit back
  7. relax
  8. grab a soda
  9. turn down the lights
  10. make popcorn
  11. get comfy
  12. take your shoes off
  13. put your feet up
  14. enjoy the show

Any questions?

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon



Missing hard drive space in Lenovo Laptops..


What they don’t want you to know…

I won’t go too far into detail on this, but I will tell you how to fix your machine. The missing hard drive space is due to Lenovo backups.  when a lenovo machine runs a backup, specifically the R61, the first back up could be in the ballpark of 3 GIGs. Now, you put about 2 gigs worth of personal files and programs on the machine. The OS was a 3 GIG install, the backup was 3 GIGS, and your stuff is 2 GIGS. The next backup will then be 3+3+2 meaning 8 GIGs. Now, lets say you don’t put anything else on. Your next backup will be 16, then 32 and so on. This is because the system is backing up the backups.. Not cool.

 What should you do?

This is not a guarantee perfect solution, because this method involves deleting backups. There is a folder on your C: drive called RRbackups. This is where your backups are kept. You cant see it because its hidden. If you would like to see it, then:

  1. Open Explorer (or just any folder)
  2. Click on Tools
  3. Click on Folder Options
  4. Click on View
  5. Click ‘ Show Hidden Files and Folders ‘
  6. Uncheck ‘ Hide protected operating system files ‘
  7. Hit OK

Great, now you can see it.. but you can’t do a thing with it… How useful. :P  The folder is locked, even if you are an Administrator, you don’t have access.  But its your machine right? You should have access to anything. well, here’s how to do it, but before I continue..  YOU COULD SCREW SOMTHING UP BY DOING THIS. BACK UP YOUR HARD DRIVE IF YOU HAVE TO, BECAUSE YOU MAY BE DELETING BACKUPS. OK, since that’s out of the way, lets get you in that folder..

  1. restart your computer, and boot into safe mode (if you are not sure, just keep hitting F8 on boot, and it will give you the option)

That’s all. When your computer comes back up, go to the C: drive, and you have full access to see how much space the RRbackups folder is taking up, ant if you want to, delete it. 

After all that, you may want to reboot back into normal mode and run a defrag, your drive fragmentation should be through the roof by now.

 Enjoy.

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon



Honorable Mention…


The site below is being given honorable mention because it is one I happen to like. If you need the Worlds Best Freeware, then you are just a few clicks away…

http://www.techsupportalert.com

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon


ForumUniversal.com is proudly powered by WordPress and themed by Mukkamu

Secured for spam by MLW and Associates, LLP's Super CAPTCHASecured by Super-CAPTCHA © 2009-2010 MLW & Associates, LLP. All rights reserved.