Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2011
    Posts
    12

    Unanswered: Installing Personal certificate

    Hi everyone i'm trying to understand the script below and currently the cert is usually found in C:\Temp

    1) strAppCache = "\\msgchhost\" & StrUserID & "$\tsprofile\" -> what does this means ? Should the path be \\localhost\c$\temp ?

    2) What if I have different cert name for different machines ?


    --------------------------------------------------
    'Aim: To silently install the given personal certificate
    '--------------------------------------------------
    Option Explicit

    Dim objShell
    Dim strCertTool, strCertPath, strCertPwd, strUserName, strAppCache, StrUserID, StrAppCacheServer
    '--------------------------------------------------
    'objShell = Windows Script Host Shell Object
    'strCertTool = path to the tool used to do the import
    'strCertPath = path to the certificate file
    'strCertPwd = certificate password
    'strUserName = current user in form DOMAIN\Username
    'strAppCache = application cache location
    '--------------------------------------------------

    '-- build the required variables --'
    Set objShell = CreateObject("WScript.Shell")
    strAppCache = "\\msgchhost\" & StrUserID & "$\tsprofile\"
    strUserName = objShell.ExpandEnvironmentStrings("%userdomain%") & "\" & objShell.ExpandEnvironmentStrings("%username%")
    StrAppCacheServer = objShell.ExpandEnvironmentStrings("%app_cache%")
    strCertTool = strAppCacheServer & "\Certificates\winhttpcertcfg.exe"
    strCertPath = strAppCache & "certificatename.pfx"
    strCertPwd = "xxxx"
    msgbox strCertpath
    '-- run the tool in a hidden window --'
    objShell****n strCertTool & " -i " & strCertPath & " -a " & strUserName & " -c CURRENT_USER\My -p " & strCertPwd, 0, True

    '-- Clean Up --'
    Set objShell = Nothing

    WScript.Quit 0
    Last edited by doran_lum; 07-29-11 at 06:46.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    that code builds a path, looking at it its comprised of:-
    a hardcoded server: \\msgchhost\
    a user id: from strUserID
    a hardcoded directory tsprofile
    so its trying to install / copy the file to say
    \\msgchhost\doran_lum\tsprofile

    so you would need to find your Citrix message server's URL name in place of \\msgchhost\
    you would need to confirm that your profiules are stored in he same manner

    the obshell****n shells out to the OS to install the certificate, all the code before sets up the various parameters used in that OS shell call

    if you are struggiling understanding what its doing then put a watch on the code and step though it seeing what is done on each line.
    debugging visual basic - Google Search
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •