Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.
ON ERROR RESUME NEXT Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path Set WSHShell = CreateObject("WScript.Shell") Set WSHNetwork = CreateObject("WScript.Network") 'Automatically grab the user's domain name DomainString = Wshnetwork.UserDomain 'Find the Windows Directory 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 500 milliseconds wscript.sleep 500 'Map drives needed by all 'Note the first command uses the user name as a variable to map to a user share. WSHNetwork.MapNetworkDrive "M:", "\\SERVER\users$\" & UserString ,True WSHNetwork.MapNetworkDrive "I:", "\\SERVER\Information",True
|File.WriteAllLines problem at random C# ASP.NET||6||38|
|VBA: Personal Macro Retain/Highlight/Remove values in a selected column||4||11|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
14 Experts available now in Live!