Tag Archive for 'How to'

How to map a drives under VBS with different logon credentials

As not to go off topic with this post I have removed most of everything else in this script apart from anything relating to drive mappings.

Please note I am no expert in scripting and the information below should be properly tested if you intend to use it.

The script below maps drives for uses in two ways. First off, it will give all users the default shares and there home drive (P, S, X).

Then it checks what groups a user is a member of and attaches the appropriate drives. (W, U, Z, M, L)

Drives M, L attach to another server and also use different logon credentials. If you required another drive with different credentials, you could try…

On the line

Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path, objNetwork, objNetwork1

Add another value “objNetwork2”

Then find in the script below and copy and paste it to a new section. Then replace all the 1’s with 2’s.

Amend the username, password and the share to reflect the desired connection. And fingers crossed it should work.

Set objNetwork1 = WScript.CreateObject(”WScript.Network”)
strLocalDrive1 = “L:”
strRemoteShare1 = “\\server\share”
strPer1 = “FALSE”
strUsr1 = “username”
strPas1 = “password”
objNetwork1.MapNetworkDrive strLocalDrive1, strRemoteShare1, strPer1, strUsr1, strPas1

‘ —— Script START ——

ON ERROR RESUME NEXT

Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path, objNetwork, objNetwork1

Set WSHShell = CreateObject(”WScript.Shell”)
Set WSHNetwork = CreateObject(”WScript.Network”)

‘Automatically find the domain name
Set objDomain = getObject(”LDAP://rootDse”)
DomainString = objDomain.Get(”dnsHostName”)
WinDir = WshShell.ExpandEnvironmentStrings(”%WinDir%”)

‘Grab the user name
UserString = WSHNetwork.UserName

‘Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject(”WinNT://” & DomainString & “/” & UserString)

‘Grab the computer name for use in add-on code later
strComputer = WSHNetwork.ComputerName

‘Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
Next

‘Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300

‘Map drives
‘Note the first command uses the user name as a variable to map to a user share.

WSHNetwork.MapNetworkDrive “p:”, “\\server\users\” & UserString,True
WSHNetwork.MapNetworkDrive “s:”, “\\server\standards”,True
WSHNetwork.MapNetworkDrive “X:”, “\\server\company”,True

‘Now check for group memberships and map appropriate drives

For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
‘Check for group memberships and take needed action
Case “grp-Admin_tools”
WSHNetwork.MapNetworkDrive “w:”, “\\server\share”,True
WSHNetwork.MapNetworkDrive “u:”, “\\server\share”,True

Case “grp-temp-user”
WSHNetwork.MapNetworkDrive “w:”, “\\Server\Share”,True
Case “grp-FTP-root-rw”
Set objNetwork = WScript.CreateObject(”WScript.Network”)
strLocalDrive = “M:”
strRemoteShare = “\\server\share”
strPer = “FALSE”
strUsr = “username”
strPas = “password”
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas

Case “grp-ftp-root-r”
Set objNetwork1 = WScript.CreateObject(”WScript.Network”)
strLocalDrive1 = “L:”
strRemoteShare1 = “\\server\share”
strPer1 = “FALSE”
strUsr1 = “username”
strPas1 = “password”
objNetwork1.MapNetworkDrive strLocalDrive1, strRemoteShare1, strPer1, strUsr1, strPas1

End Select

Next

‘=====================================
‘Add On Code goes above this line

‘Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing
Set objNetwork = Nothing
Set objNetwork1 = Nothing

‘Quit the Script
wscript.quit

‘ —— Script END ——

Secure you’re Gmail

gmail https in the address bar

Gmail has been around for a while now and is still the #1 choice for most webmail users.

Gmail acheives this by inovation and giving the users what they want, like accessing it over a secure connection.

Without going in to too much detail, the reason you want to use https is that all communication that takes place between your PC and the gmail server will be kept private.  This means nobody at work will be able to take a peak at what your doing or that geeky kid at the back of starbuck will not steal your passwords.

gmail https options

How to enable HTTPS in Gmail

  1. logon to your gmail account
  2. locate and click on settings at the top right of your screen
  3. under the general tab scroll to the bottom
  4. you should now see the options for browser connection
  5. click always use https
  6. click the button save changes
  7. sit back and access gmail with all the secure socket layer protection goodness

Keep the focus on format painter

What did you do before you knew about format painter?  Well my guess is a shed full of repetitive formatting.

Format Painter is one of those time saving shortcuts that once you have found it, life using Word and Excel is a much more pleasant experience.

MS Word 2003 MS Word 2003
word2003 fromat painter word2007 fromat painter

Basic usage

  • Simply place your cursor within your document text that has your desired format
  • Click the Format Painter icon (I have included screen shots of MS word 2003 & 2007)
  • You will notice your cursor will change to fromatpainter icon, you can now highlight the text you want to change and hey presto it takes on a new format!

Power usage

As of MS Office 2007 format painter gets a natty advertisement of this power tweak (see the screenshot on the right, above) but it also applies to previous version and for all of you that do not know about it all you need to do is shut your eyes and…..

Double click (the tool bar icon)

Now the Format Painter icon will not revert to the standard cursor and you can format till your heart content.  To revert to your normal cursor simply press the ESCAPE key or click the tool bar icon again.

What are you waiting for, get formatting!

install ubuntu on a powerbook

Virtualbox is a great virtualization product for OS X that also works on Windows and Linux!

In this How to it will show you how to get Ubuntu up and running within OS X.

  install ubuntu on a powerbook (985.2 KiB, 9 hits)
You need to be a registered user to download this file.