Tag Info

Hot answers tagged

12

Just found this one pasted below. You can run it with cscript and have it scheduled. 'Set your settings strFileURL = "http://www.domain.com/file.zip" strHDLocation = "D:\file.zip" ' Fetch the file Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP") objXMLHTTP.open "GET", strFileURL, false objXMLHTTP.send() If objXMLHTTP.Status ...


12

I realize the question is about modifying the host file via vbscript. Would it be more effective to create a new internal DNS entry for the hostname you're trying to resolve? If you truly want EVERY user/machine on the network to see this change, perhaps this would be easier? Adding DNS Services to your Windows 2003 Server at Petri. The Microsoft ...


9

The following VBScript will do it: OPTION EXPLICIT DIM CRLF, TAB DIM strServer DIM objWebService TAB = CHR( 9 ) CRLF = CHR( 13 ) & CHR( 10 ) IF WScript.Arguments.Length = 1 THEN strServer = WScript.Arguments( 0 ) ELSE strServer = "localhost" END IF WScript.Echo "Enumerating websites on " & strServer & CRLF SET objWebService = ...


9

I'm a VBScript man, but even I've realised that the Windows world has shifted towards Powershell! All the Microsoft products are now extensively supporting Powershell extensions, and it's so much more powerful than VBScript. Embrace powershell!


6

It would be much easier if you used Group Policy Preferences to map the drives and did item-level targeting to filter drive maps by group. This is the preferred way.


6

PowerShell 2, without any doubts. I reckon it fulfils all your requirements, and its Integrated Scripting Environment does syntax highlighting and has nice debugging support, including breakpoints and step-by-step execution.


6

Try for /? on the command line. The help shows all kinds of useful filename substitutions, such as: %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive letter only %~pI - expands %I to a path only %~nI - expands %I to a file name only %~xI ...


6

Errr, tidy up your GPOs, and disable it there. Or, at the very least, create a new GPO at the top of the stack (highest precedence) and disable the firewall. Then go back and tidy your other GPOs later. Local Security policy gets overridden by GPOs, and the first area of the registry you're writing to is specifically for GPO processing. Short answer... ...


5

I'd like to preface this by saying that I strongly urge anyone that disables their Windows firewall to take the time to understand how it works and how to manipulate it via GPO instead of outright turning it off. There's no reason to turn off a host-based firewall. Microsoft makes excellent tools to manage firewall rules, you should use them. This TechNet ...


5

Fire up Windows PowerShell and run: $strSID="S-1-5-21-500000003-1000000000-1000000003-1001" $uSid = [ADSI]"LDAP://<SID=$strSID>" echo $uSid The output should look something like this, distinguishedName : {CN=John Doe,OU=Domain Admins,OU=People,OU=xxx,DC=xxx} Path : LDAP://<SID=S-1-5-21-500000003-1000000000-1000000003-1001>


5

You could use something like the following. It reads the registry key for PowerShell. If the read is successful (return code 0), or not, you get the corresponding message box, which you can switch out for other logic you need to do--like install PowerShell if it's not detected. See the source links below for more info. Option Explicit Dim oShell Dim value ...


5

The rightâ„¢ way to do this is to use a startup/logon script in GPO or Use a Group Policy File/Shortcut Preference item if your clients are Vista/7 or XP w/ the GPP Extensions add-on. The reason that you don't want to do this the way that you proposed is that if a computer is not on or is unavailable or has a file locked, this won't work. A logon script or ...


4

What's wrong with looking at the %COMPUTERNAME% environmental variable and pre-pending IUSR_?


4

You could accomplish this using registry hacks in your batch files, but GPO would be the appropriate and best way to go. With a GPO, you can control the the settings from being changed back by a user or rougue website. GPOs will apply every hour and 1/2 or so in most environments, whereas your scripts (I'm guessing) are more manual in nature. Here's a ...


4

The "LDAP way" to do this would be to retrieve the base object with the GUID (or SID), which will retrieve only the base object and not have additional class data attached. However, from this base object you can retrieve the actual "distinguishedName" for the user object. Retrieving the user object using the "distinguishedName" attribute will return a ...


4

The keys you're looking for are located here: \\HKCU\Network Each mapped drive is represented by a Registry key named for the drive letter. The properties of the mapping are contained in values - the ones you are most likely to be interested in are: RemotePath REG_SZ UserName REG_SZ The keys will only exist for Persistent connections, I don't think ...


4

If you've got a domain, simply use the login script (group policy object) method others suggest and tell everyone to reboot. Better: add the entry to your local DNS server instead. Failing that, VBScript still isn't required. Consider a batch file with lines like this: echo 10.20.30.40 fishsticks >> \\hostname\c$\windows\system32\drivers\etc\hosts ...


4

Your script is running fine. Because your Vista users are Administrators and because you have User Account Control enabled the users' filtered token, under which Explorer runs, doesn't have access to the "drives" that were "mapped" when the logon script ran. You have two choices: Make the users standard users. This would be my preference, but seems to be ...


4

Have a go at this. New info is added at the bottom of the script. One caveat, NIC (ndis) link speed is given by a different provider than the other NIC properties. As such there are 2 new sections for NIC info: NIC Instance Information and NIC Link Information. Each enumerates all the NICs in your machine and gives the relevant info. ...


4

For a windows 2003 server query: netsh dhcp server <type.srvIP.here> scope s.s.s.s show client | find "clientIP" netsh dhcp server <type.srvIP.here> scope s.s.s.s show client | find "MACAddress" You'll need to know the scope (s.s.s.s) in which this client is on, to show scopes: netsh dhcp server <type.srvIP.here> show scope Why not ...


4

Windows has the ability to share concurrent access to files through mechanisms such as byte-range locks, whereby a process locks only a certain region of a file, etc. But applications have to be written appropriately to take advantage of this. It is entirely possible to code your application in such a way that you lock the entire file, and not just a region ...


3

You could simply copy the file to all your machines from an administrator logon. That's more or less what I did. I just did it one at a time, but you could put that in a batch file.


3

Try: wshNetwork.MapNetworkDrive "S:","\\server\shared", True wshNetwork.MapNetworkDrive "U:","\\server\" & wshNetwork.UserName, True I also add a routine to remove all the shares just to avoid "device is already in use" errors that I was getting, prior to mapping the drives. wshNetwork.RemoveNetworkDrive "S:", True, True wshNetwork.RemoveNetworkDrive ...


3

If you can work out the switches you require to get the MSI to install in a totally unattended manner you can use psexec part of pstools from Microsoft/SysInternals. psexec \\workstation -u DOMAIN\Admin User -p password msiexec /i "\\server\share\installer.msi" switches Having tried it, the process is very hit and miss; some installers will work some are ...


3

Although we use powershell on our servers, we use vbscript on the clients to login. VBscript is installed by default and we use it instead of CMD batch files because of the access to wmi and specifically we use it to install all the appropriate printers.


3

If you have a domain, then I'd look at doing a Group Policy Preference for the drive mapping. You should be able to have it map a given UNC to a given drive, and automatically replace any old mappings that exist.


3

This first depends upon whether the string refers to an object or a class. For objects; you can cast the string to wmi. For classes; you can cast the string to wmiclass. [wmi] 'root\MicrosoftIISv2:IIsWebVirtualDir="W3SVC/1/ROOT"' [wmiclass] 'root\MicrosoftIISv2:IIsWebVirtualDir' Some method names in WMI might be changed from their wsh names, eg ...


3

Try downloading devcon.exe and running devcon find * to identify the hardware ID and then devcon disable <HardwareID> to disable it. For example: P:\>devcon find * | find /i "keyboard" HID\VID_413C&PID_2105\6&237B9D6D&0&0000 : HID Keyboard Device ROOT\RDP_KBD\0000 ...


3

ADSUtil just uses GetObject under the covers (IIS is exposed as a garden variety ADSI provider), so you can simply target the property you're interested in (if you know the path) with something like set oSite = GetObject("IIS://localhost/W3SVC/1/ROOT") Wscript.echo oSite.AnonymousUserName for the default web site, or this (as in your example above) for ...


3

It would run longer if you moved to x64. It could use as much memory as you could throw at it before blowing up. In x86, you probably would not even reach the 2 GB process limit before blowing up. Then you could recycle the application pool less often and hopefully after hours when fewer users are impacted. But does it "handle VBScript better or more ...



Only top voted, non community-wiki answers of a minimum length are eligible