"MarceepooNu" <mbh2010@xxxxxx> wrote in message
news:1FCA7D5A-F386-403F-9BCF-C0B3E95EA356@xxxxxx
> The script below runs just fine under Xp, but bombs out in Vista,
> presumably
> to do Vista's enhanced security.
>
> Any suggestions about how to get this script to run properly under Vista
> would be much appreciated. (I'd like to know where I can learn about how
> to
> deal in general with the security related problems that I'll encounter
> w/scripts under Vista. So any pointers to a good url would be much
> appreciated.)
> Thanks for your time. It is much appreciated.
>
> MarceepooNu
>
> Here's the script:
> Set objComputer = CreateObject("Shell.LocalMachine")
>
> sCmptrNam = objComputer.MachineName
> WScript.Echo "sCmptrNam = " & sCmptrNam
>
> If UCase(sCmptrNam) = "marcmacv1" Then
> strURL = "C:\Users\marxp\AppData\Roaming\Microsoft\Word\Startup"
> ElseIf UCase(sCmptrNam) = "ZAPPA" Then
> strURL = "C:\Documents and Settings\marxp.law\Application
> Data\Microsoft\Word\STARTUP"
> ElseIf Left(UCase(sCmptrNam) , 3) = "amber-2core" Then
> strURL = "C:\Documents and Settings\amber\Application
> Data\Microsoft\Word\STARTUP"
> ElseIf Left(UCase(sCmptrNam) , 4) = "RESERVED_FOR_LATER_USE" Then
> strURL = "C:\Documents and Settings\marxp\Application
> Data\Microsoft\Word\STARTUP"
> Else
> strURL = "C:\Documents and Settings\marxp\Application
> Data\Microsoft\Word\STARTUP"
> End If
>
>
> Set objShell = CreateObject("Wscript.Shell")
> objShell.Run("explorer.exe /e, " & strURL)
> Comments:
1. I don't believe component Shell.LocalMachine exists.
2. You can get the NetBIOS name of the local computer from the wshNetwork
object.
3. UCase(sCmptrNam) can never be equal to the lower case string "marcmacv1".
4. The first 3 characters of sCmptrNam can never be equal to an 11 character
string.
5. The first 4 characters of sCmptrNam can never be equal to a 22 character
string.
I have not tested, and have not started IE from a script this way, but as a
start I would suggest:
==========
Set objNetwork = CreateObject("Wscript.Network")
sCmptrNam = objNetwork.ComputerName
Wscript.Echo "sCmptrNam = " & sCmptrNam
If UCase(sCmptrNam) = "MARCMACV1" Then
strURL = "C:\Users\marxp\AppData\Roaming\Microsoft\Word\Startup"
ElseIf UCase(sCmptrNam) = "ZAPPA" Then
strURL = "C:\Documents and Settings\marxp.law\Application
Data\Microsoft\Word\STARTUP"
ElseIf Left(UCase(sCmptrNam), 11) = "AMBER-2CORE" Then
strURL = "C:\Documents and Settings\amber\Application
Data\Microsoft\Word\STARTUP"
ElseIf Left(UCase(sCmptrNam), 22) = "RESERVED_FOR_LATER_USE" Then
strURL = "C:\Documents and Settings\marxp\Application
Data\Microsoft\Word\STARTUP"
Else
strURL = "C:\Documents and Settings\marxp\Application
Data\Microsoft\Word\STARTUP"
End If
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("explorer.exe /e, " & strURL)
========
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--