Deployment Solution

 View Only
Expand all | Collapse all

Vbscript with DS 6.9

  • 1.  Vbscript with DS 6.9

    Posted Jul 09, 2010 03:58 PM
    Hi

    I am pushing out a vbscript that will make a registry change on the machines it is run on. However I am having an issue with it running correctly with DS. The script runs correctly when run locally on the machine but it is is pushed out and then run it does not execute. I have tried to run it with system permissions, and my admin domain account neither of which will work correctly. Any ideas as to what I am doing wrong? Thanks in advance.

    d


  • 2.  RE: Vbscript with DS 6.9

    Trusted Advisor
    Posted Jul 09, 2010 06:50 PM
    Is your script embedded? In order for vbscripts to execute on DS when embedded, the first line needs to be,

    'vbscript

    This tells the engine that the embedded text needs to be executed not as a batch file, but as a vbscript.




  • 3.  RE: Vbscript with DS 6.9

    Posted Jul 09, 2010 09:17 PM
    No it is not embedded. I push out a file and execute it on the machine. I have other scripts that I execute the same way with no problems.  I was thinking that perhaps it was because I was doing a registry edit that it might be the issue.

    d


  • 4.  RE: Vbscript with DS 6.9

    Trusted Advisor
    Posted Jul 10, 2010 01:29 AM
    When you say "does not execute" do you actually mean that? If  the script runs successfully, but just not produce the desired result it might be because the security context that the script is running under  isn't the same as you when you're logged in.

    For example, if you make changes to the HKEY_LOCAL_MACHINE hive with your script, all users will see this change. However if you make changes to HKEY_CURRENT_USER, this is limited purely to the context of the user running the script.

    Kind Regards,
    Ian./


  • 5.  RE: Vbscript with DS 6.9

    Posted Jul 10, 2010 04:09 PM
    Sorry I misspoke. This is the edit I am doing. 


    strServerPath="\\0631-w2k3-i10\Staff"
    strFavoriteRedirectRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites"
    strFavoriteRedirectLocation = strServerPath & "\%username%\Favorites"
    strFavoriteRedirectRegType = "REG_EXPAND_SZ"


    The previous setting was "%USERPROFILE%\Favorites". When I execute the script manually on the machine as the local administrator or as a domain administrator the redirect location is changed to \\0631-w2k3-i10\Staff\%username%\Favorites . However when executing the script via Atiris DS I observe the command window appear very breifly and no errors are thrown. So I am assuming that the script executed but did not make the edit. If I go into regedit and look at the HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites" value it is still  "%USERPROFILE%\Favorites"

    Thanks again Ian for your help.

    d


  • 6.  RE: Vbscript with DS 6.9

    Trusted Advisor
    Posted Jul 10, 2010 05:06 PM
    Hi,

    Without seeing the whole script, I can't comment too much, but can you try something for me which doesn't entail using DS at all?

    Run the script as administrator, and then create a new user on this machine, called test for example. Then login as test . What are you expecting to see, and what do you see?

    Kind Regards,
    Ian./


  • 7.  RE: Vbscript with DS 6.9

    Posted Jul 10, 2010 06:57 PM
    Here is the entire script. It is "suppose" to change the default location of Internet Explorer's favorites. Will run test and get back to you. 


    '**************************************************************************
    '******************************** Header Section **************************
    '**************************************************************************
    '
    Option Explicit
    '
    'Variable for shell object
    Dim wshShell
     
    'Variable for redirecting Favorites
    Dim strFavoriteRedirectRegKey
    Dim strFavoriteRedirectLocation
    Dim strFavoriteRedirectRegType
     
    'Variable for redirecting Application Data Folder
    Dim strApplicationDataRedirectRegKey
    Dim strApplicationDataRedirectLocation
    Dim strApplicationDataRedirectRegType
     
    'Variable for Server Path
    Dim strServerPath
     
    '**************************************************************************
    '********************* DO NOT EDIT ABOVE THIS LINE ************************
    '****************** IF YOU DO DON'T CALL OR EMAIL DAN *********************
    '**************************************************************************
     
    strServerPath="\\0631-w2k3-i10\Staff"
     
    '**************************************************************************
    '********************* DO NOT EDIT BELOW THIS LINE ************************
    '****************** IF YOU DO DON'T CALL OR EMAIL DAN *********************
    '**************************************************************************
    '
    '
    '**************************************************************************
    '******************************* Reference Section ************************
    '**************************************************************************
     
    'CREATE GLOBAL OBJECTS
    Set wshShell = CreateObject("WScript.Shell")
     
    '**************************************************************************
    '***************************** INITIALIZE VARIABLES ***********************
    '******************** Favorites Redirection Registry Info *****************
    '**************************************************************************
     
    strFavoriteRedirectRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites"
    strFavoriteRedirectLocation = strServerPath & "\%username%\Favorites"
    strFavoriteRedirectRegType = "REG_EXPAND_SZ"
     
    '**************************************************************************
    '***************************** Output Section *****************************
    '**************************************************************************
     
    'Delete existing favorites registry entry.
    wshShell.RegDelete strFavoriteRedirectRegKey
     
    'Redirect Favorites by writing registry entry.
    wshShell.RegWrite strFavoriteRedirectRegKey,strFavoriteRedirectLocation,strFavoriteRedirectRegType


  • 8.  RE: Vbscript with DS 6.9

    Posted Jul 10, 2010 08:13 PM
    OK here is how it went. I didn't think about the HKEY_CURRENT_USER issue when I created the script. May have to rethink this. Signed on to the machine as a local admin. Ran the script and checked with regedit. It did change the current user. Signed on to the server and created a new domain user. Signed on to the local machine with that account and checked with regedit. Back to default as you pointed out. Ran the script again as the new user. Signed out and then back in to the machine. Ran Internet explorer, saved a favorite and it did save to the server correctly.

    My goal is to have the users favorites saved to their redirected folder on the server. I also checked the default user on the local machine and the favorites for that user are for the correct location on the server. I thought that all of a new users settings were created from that location. Am I misunderstanding this? Do you have a suggestion as to how I can achieve this goal? 

    Thanks again for your help.

    d


  • 9.  RE: Vbscript with DS 6.9
    Best Answer

    Trusted Advisor
    Posted Jul 11, 2010 03:35 AM
    I think the only way this script would work, is as a logon script -which means you'll have to configure this at the domain level.

    I'd worry though that people with existing local favorites locations will suddenly 'lose' their favorites when they get redirected to the server?

    I would add a few lines here to copy anything that is local to the remote server location. That way, you won't upset anyone!

    Kind Regards,
    Ian./


  • 10.  RE: Vbscript with DS 6.9

    Posted Jul 11, 2010 04:55 PM
    Thanks, BTW I have a separate script that does move the favorites to the new location.. 


  • 11.  RE: Vbscript with DS 6.9

    Trusted Advisor
    Posted Jul 11, 2010 05:23 PM
    No problem.  Good end to the weekend and finally untangle this one with you!

    Kind Regards,
    Ian./