If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Installing Personal certificate

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-29-11, 05:39
doran_lum doran_lum is offline
Registered User
 
Join Date: Jul 2011
Posts: 12
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 05:46.
Reply With Quote
  #2 (permalink)  
Old 07-29-11, 05:48
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On