Is there a way to autoincrement VS2013 Installer Project version numbers - visual-studio-2013

We currently have several VS2013 Setup/Installer Projects configured, and need to move to an automated deployment process.
One of the things that is therefore required is an autoincrementing version number of the installer (msi).
Is there a way to do this in VS2013? We use TeamCity for builds and deployment, and git for source control.
I gather there are other packages (Wix for example) that already support this, but if we could stick with VS2013 that would be the best for us atm.

You can use the vs extension - Auto Version Incrementer:
https://visualstudiogallery.msdn.microsoft.com/e30465a4-dab9-44ca-815b-b390ceeef6ab
Update: the requested can be achieved by the following article: http://www.codeproject.com/Articles/22256/NewSetupVersion-for-MSI-Projects
and the described script in it:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Increment the version number of an MSI setup project
'' and update relevant GUIDs
''
'' Hans-Jürgen Schmidt / 19.12.2007
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
set a = wscript.arguments
if a.count = 0 then wscript.quit 1
'read and backup project file
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(a(0))
s = f.ReadAll
f.Close
fbak = a(0) & ".bak"
if fso.fileexists(fbak) then fso.deletefile fbak
fso.movefile a(0), fbak
'find, increment and replace version number
set re = new regexp
re.global = true
re.pattern = "(""ProductVersion"" = ""8:)(\d+(\.\d+)+)"""
set m = re.execute(s)
v = m(0).submatches(1)
v1 = split(v, ".")
v1(ubound(v1)) = v1(ubound(v1)) + 1
vnew = join(v1, ".")
'msgbox v & " --> " & vnew
s = re.replace(s, "$1" & vnew & """")
'replace ProductCode
re.pattern = "(""ProductCode"" = ""8:)(\{.+\})"""
guid = CreateObject("Scriptlet.TypeLib").Guid
guid = left(guid, len(guid) - 2)
s = re.replace(s, "$1" & guid & """")
'replace PackageCode
re.pattern = "(""PackageCode"" = ""8:)(\{.+\})"""
guid = CreateObject("Scriptlet.TypeLib").Guid
guid = left(guid, len(guid) - 2)
s = re.replace(s, "$1" & guid & """")
'write project file
fnew = a(0)
set f = fso.CreateTextfile(fnew, true)
f.write(s)
f.close

Related

set Shell = new (Shell.appliecaton)

I've been using Shell to unzip a file. Suddenly it stopped working with the error:
"Class does not support Automation or does not support expected interface"
If I build it on a Win7 machine, it runs on the Win7 machine but not on Win10.
If I build it on a Win10 machine it runs on the Win10 machine but not on the Win7 machine.
An earlier version ran fine on both machines when built on the Win7 machine.
I've carefully compared the .aip build files (Advanced Installer) and they are identical. I haven't touched the code in question for 3 or 4 months.
Here is the Code I'm using (you may recognize it):
{
Dim ShellClass As shell32.Shell
Dim FileSource As shell32.Folder
Dim Filedest As shell32.Folder
Dim Folderitems As shell32.Folderitems
If sFileSource = "" Or sFileDest = "" Then
GoTo Zip_Activity_Err
End If
Select Case UCase$(Action)
Case "ZIPFILE"
If Right$(UCase$(sFileDest), 4) <> ".ZIP" Then
sFileDest = sFileDest & ".ZIP"
End If
If Not Create_Empty_Zip(sFileDest) Then
GoTo Zip_Activity_Err
End If
Set ShellClass = New shell32.Shell
Set Filedest = ShellClass.NameSpace(sFileDest)
Call Filedest.CopyHere(sFileSource, 20)
Case "ZIPFOLDER"
If Right$(UCase$(sFileDest), 4) <> ".ZIP" Then
sFileDest = sFileDest & ".ZIP"
End If
If Not Create_Empty_Zip(sFileDest) Then
GoTo Zip_Activity_Err
End If
Set ShellClass = New shell32.Shell
Set FileSource = ShellClass.NameSpace(sFileSource)
Set Filedest = ShellClass.NameSpace(sFileDest)
Set Folderitems = FileSource.Items
Call Filedest.CopyHere(Folderitems, 20)
Case "UNZIP"
If Right$(UCase$(sFileSource), 4) <> ".ZIP" Then
sFileSource = sFileSource & ".ZIP"
End If
Set ShellClass = New shell32.Shell <--- Here's where it fails
Set FileSource = ShellClass.NameSpace(sFileSource)
Set Filedest = ShellClass.NameSpace(sFileDest)
Set Folderitems = FileSource.Items
Filedest.CopyHere Folderitems, _
NoUserInterfaceIfErr + _
NoConfirmOfNewDir + _
YesToAll + NoProgBox
Case Else
End Sele
}
The solution is probably to use late binding.
So use Set Obj = CreateObject("Shell.Application")
Late binding is a conversation.
YourProg: Hi shell, do you have a namespace command?
Shell: Yes I do, It's command number 5.
YourProg: Please do command number 5 - here are the parameters
Shell: Here's the return data, if any.
Early binding your program is compiled with both the GUID and to jump to 5th offset in the vtable.

Access Microsoft Outlook to print the List of members

Please advice how to get the following
From Microsoft outlook
Type SOMETHING in the “search address books”
Click properties
In the Members list we see all the members names
The target is to print all the members names to a file.
How to do this task with VB script or with any other Code?
example:
I found this, but I not understand how to set my distribution list in the VB code to print the distribution list members
For example If I have the distribution list MY_HOME
how do I insert the MY_HOME in the VB code to print all members?
Const olFolderContacts = 10
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
intCount = colContacts.Count
For i = 1 To intCount
If TypeName(colContacts.Item(1)) = "DistListItem" Then
Set objDistList = colContacts.Item(i)
Wscript.Echo objDistList.DLName
For j = 1 To objDistList.MemberCount
Wscript.Echo objDistList.GetMember(j).Name & " -- " & _
objDistList.GetMember(j).Address
Next
Wscript.Echo
End If
Next
Call Namespace.CreateRecipient / Recipient.Resolve / Recipient.AddressEntry.Members.
UPDATE:
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon
set objRecip = objNamespace.CreateRecipient("MY_HOME")
if objRecip.Resolve Then
set objMembers = objRecip.AddressEntry.Members
if not (objMembers Is Nothing) Then
for each objMember in objMembers
Wscript.Echo objMember.Name & " : " & objMember.Address
next
end If
End If

subscript out of range error in vbscript

Can someone look at the below script and tell me why it's throwing this error subscript out of range error in vbscript ..In the text file there are two entries it writes to the file correctly but then it throws an error while exiting the loop so it never calls the other function..I think it's trying to run 3 times but there are just 2 entries in the text file
The text file is in this format
Format.css Shared
Design.css Shared
Dim strInputPath1
Dim txsInput1,txsOutput
Dim FSO
Dim Filename
Set FSO = CreateObject("Scripting.FileSystemObject")
strOutputPath = "C:\txt3.txt"
Set txsOutput = FSO.CreateTextFile(strOutputPath)
Set re = New RegExp
re.Pattern = "\s+"
re.Global = True
Set f = FSO.OpenTextFile("C:\Users\spadmin\Desktop\Main\combination.txt")
Do Until f.AtEndOfStream
tokens = Split(Trim(re.Replace(f.ReadLine, " ")))
extension = Split(tokens(0),".")
strInputPath1 = "C:\inetpub\wwwroot\Test\files\" & tokens(1) & "\" & extension(1) & "\" & tokens(0)
Set txsInput1 = FSO.OpenTextFile(strInputPath1, 1)
WScript.Echo strInputPath1
txsOutput.Writeline txsInput1.ReadAll
Loop
WScript.Echo "Calling"
txsInput1.Close
txsOutput.Close
f.Close
Call CreateCSSFile()
''''''''''''''''''''''''''''''''''''
' Merge Css Files
''''''''''''''''''''''''''''''''''''
Sub CreateCSSFile()
WScript.Echo "Called"
Dim FilenameCSS
Dim strInputPathCSS
Dim txsInputCSS,txsOutputCSS
Dim FSOCSS
Set FSOCSS = CreateObject("Scripting.FileSystemObject")
strOutputPathCSS = "C:\txt4.txt"
Set txsOutputCSS = FSOCSS.CreateTextFile(strOutputPath)
Set re = New RegExp
re.Pattern = "\s+"
re.Global = True
Set fCSS = FSOCSS.OpenTextFile("C:\Users\spadmin\Desktop\TestingTheWebService\combination.txt")
Do Until fCSS.AtEndOfStream
tokensCSS = Split(Trim(re.Replace(fCSS.ReadLine, " ")))
extensionCSS = Split(tokensCSS(0),".")
strInputPathCSS = "C:\inetpub\wwwroot\EpsShared\c\" & tokensCSS(1) & "\" & extensionCSS(1) & "\" & tokensCSS(0)
Set txsInputCSS = FSOCSS.OpenTextFile(strInputPathCSS, 1)
txsOutputCSS.Writeline txsInputCSS.ReadAll
Loop
fCSS.Close
txsInputCSS.Close
txsOutputCSS.Close
Set FSOCSS = Nothing
End Sub
If your file contains trailing blank lines, applying Split() may return arrays with less than 2 elements. In that case token(1) should throw a 'subscript out of range' error.
You should always check, if Split() workes as expected:
tokens = Split(Trim(re.Replace(f.ReadLine, " ")))
If 1 = UBound(tokens) Then
extension = Split(tokens(0),".")
If 1 = UBound(extension) Then
strInputPath1 = "..." & tokens(1) & "..."
Else
... parse error ...
End If
Else
... parse error or just trailing blank lines? ...
End If

Auto generate outlook signature by GPO using multiple signatures

A while back i have searched for a flexible way to automatically generate a signature for different types of users. Our domain has multiple companies and each have different needs. The default scripts you find when googeling simply shows how to create a basic signature.
The script below takes is a few steps further. It fills in the username & initials when first starting up Microsoft Office. If no outlook profile is present it will set up outlook using a PRF file (you can use cached for laptops/tablets and non cached for desktops / servers). It then checks which signatures a user should get and builds them using the information in the signature file, template file and user information from active directory. All status information gets written to the application event log (filter WSH). When a signature file gets updated, the signature will be re-applied.
I am posting the entire script here hoping that someone else might find it usefull. Feel free to comment (or donate ofcourse :-)). It works for Outlook 2000, 2003, 2010 and 2013 (and should be pretty future proof).
Create a new Global Securitygroup in your domain. In my example i will use Signature-Marketing and Signature-HR.
Create a new GPO that applies on these groups. Place the Outlook.vbs script in User \ Policy \ Windows \ Scripts \ Logon.
'\\MyDomain.local\SysVol\WGIT.local\Policies\{MyPolicyID}\User\Scripts\Logon\Outlook.vbs
On Error Resume Next
' ##### CHANGE THESE SETTINGS #####
setup_GroupPrefix = "Signature-"
setup_Path_SignatureVBS = "\\MyDomain.local\NETLOGON\Outlook\Signatures" 'Signatures with the same name as this group (+.VBS) will be searched within this
setup_Path_Template = "\\MyDomain.local\NETLOGON\Outlook\Templates" 'Signatures with the same name as this group (+.VBS) will be searched within this
setup_PRF_CacheOn = "\\MyDomain.local\NETLOGON\Outlook\PRF\Outlook_Cached.PRF"
setup_PRF_CacheOff = "\\MyDomain.local\NETLOGON\Outlook\PRF\Outlook_NotCached.PRF"
' ##### START OF SCRIPT #####
Set oShell = CreateObject("WScript.Shell")
Set oAD = CreateObject("ADSystemInfo")
Set oFile = CreateObject("Scripting.FileSystemObject")
Set oOutlook = CreateObject("Outlook.Application")
Set oUser = GetObject("LDAP://" & oAD.UserName)
'Quit if no outlook is present!
If oOutlook = false Then
oShell.LogEvent 1, "Signature script error. Outlook application object was not found."
Wscript.Quit
End If
'Quit if version is lower then 10
v = Split(oOutlook.Version, ".")
outlook_Version = v(0) & "." & v(1)
If cInt(v(0)) < 10 Then
oShell.LogEvent 1, "Signature script error. Outlook version " & outlook_Version & " is not supported."
Wscript.Quit
ElseIf (cInt(v(0)) >= 10) And (cInt(v(0)) < 15) Then
reg_DefaultProfile = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\DefaultProfile"
Else
reg_DefaultProfile = "HKCU\Software\Microsoft\Office\" & outlook_Version & "\Outlook\DefaultProfile"
End If
'Check if Office's Userinfo already exists
t1 = oShell.RegRead("HKCU\Software\Microsoft\Office\Common\UserInfo\UserName")
If t1 = "" Then
'Add userinfo to registry.
oShell.RegWrite "HKCU\Software\Microsoft\Office\Common\UserInfo\UserName", oUser.FullName
oShell.RegWrite "HKCU\Software\Microsoft\Office\Common\UserInfo\UserInitials", oUser.sAMAccountName
oShell.RegWrite "HKCU\Software\Microsoft\Office\Common\UserInfo\Company", oUser.company
oShell.LogEvent 0, "Office userinformation was imported from AD."
End If
'Check for a default mail profile
t2 = oShell.RegRead(reg_DefaultProfile)
oShell.LogEvent 0, "Default profile (" & reg_DefaultProfile & ") said " & t2
If t2 = "" Then 'No default profile was found! Import PRF file!
'Detect mobile devices. Enabled cached outlook if there is a battery present
MobileDevice = false
Set oBattery = GetObject("Winmgmts:").ExecQuery("Select * from Win32_Battery")
For Each x in oBattery
MobileDevice = true
Next
'Import PRF location into registry
If MobileDevice Then
oShell.RegWrite "HKCU\Software\Microsoft\Office\" & outlook_Version & "\Outlook\Setup\ImportPRF", setup_PRF_CacheOn
oShell.LogEvent 0, "Office Outlook has been set-up with cache."
Else
oShell.RegWrite "HKCU\Software\Microsoft\Office\" & outlook_Version & "\Outlook\Setup\ImportPRF", setup_PRF_CacheOff
oShell.LogEvent 0, "Office Outlook has been set-up without cache."
End If
'Delete First-Run key to simulate a first run for outlook. (i.e. if a profile was configured and deleted)
oShell.RegDelete "HKCU\Software\Microsoft\Office\" & outlook_Version & "\Outlook\Setup\First-Run"
'Outlook does not need to be run.
'When a signature is being applied outlook will fire up it's initial boot and import the PRF settings.
'With this PRF applied the signature will be applied immediately
End If
'Compare users' group membership against available signature settings
Set GroupsOfUser = GetMembership(oUser.distinguishedName, null)
tGroups = Array()
For Each GroupName in GroupsOfUser.Items()
If Mid(GroupName, 1, Len(setup_GroupPrefix)) = setup_GroupPrefix Then
ReDim Preserve tGroups(UBound(tGroups) + 1)
tGroups(UBound(tGroups)) = GroupName
end if
Next
tGroups = SortArray(tGroups)
For Each group in tGroups
sFile = setup_Path_SignatureVBS & "\" & group & ".VBS"
If oFile.FileExists(sFile) = True Then 'File containing specific signature settings were found
Set Signature = new Defaults 'Use defaults
'Evaluate signature settings
executeGlobal oFile.openTextFile(sFile).readAll()
'Check if signature needs updating
sUpdate = false
If oFile.FileExists(Signature.sPath) Then
Set f = oFile.GetFile(Signature.sPath)
If Signature.sVersion > f.DateLastModified Then
sUpdate = true
End If
Else
sUpdate = true
End If
If sUpdate Then 'Apply signature
'Replace defaults with user specific data
If Not oUser.FullName = "" Then Signature.uName = oUser.FullName
If Not oUser.mail = "" Then Signature.uMail = LCase(oUser.mail)
If Not oUser.telephoneNumber = "" Then Signature.uPhone = oUser.telephoneNumber
If Not oUser.mobile = "" Then Signature.uCell = oUser.mobile
If Not oUser.facsimileTelephoneNumber = "" Then Signature.uFax = oUser.facsimileTelephoneNumber
If Not oUser.Title = "" Then Signature.uTitle = oUser.Title
If Not oUser.department = "" Then Signature.uDepartment = oUser.department
If Not oUser.info = "" Then Signature.uDisclaimer = oUser.info
'Build signature
Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Add()
Set oSelection = oWord.Selection
executeGlobal oFile.openTextFile(setup_Path_Template & "\" & Signature.sTemplate).readAll() 'Evaluate signatre template
Set oSelection = oDoc.Range()
'Add signature to outlook
oWord.EmailOptions.EmailSignature.EmailSignatureEntries.Add Signature.sName, oSelection
WScript.Sleep 200 'Give outlook the time to create the necessary files
'Set as default signature
If Signature.sCompanyNew = "*" OR StrComp(oUser.company, Signature.sCompanyNew, vbTextCompare) = 0 Then oWord.EmailOptions.EmailSignature.NewMessageSignature = Signature.sName
If Signature.sCompanyReply = "*" OR StrComp(oUser.company, Signature.sCompanyReply, vbTextCompare) = 0 Then oWord.EmailOptions.EmailSignature.ReplyMessageSignature = Signature.sName
'Closure
oDoc.Saved = True
oWord.Quit
WScript.Sleep 300 'Give work some time to clean up
'Logging
oShell.LogEvent 0, "Signature " & Signature.sName & " applied with success!"
Else
oShell.LogEvent 0, "Signature " & Signature.sName & " is up to date."
End If
Else
oShell.LogEvent 1, "Signature script error. Cannot load signature settings from " & sFile
End If
Next
' ##### CLASSES AND FUNCTIONS ######
Class Defaults
'Signature properties
Public sName 'Name of this signature
Public sVersion 'Apply signature if version date is newer then client's signature date
Public sTemplate 'Signature template to be used
Public sCompanyNew 'If the user company field matches this value it will be set as the default 'new' signature
Public sCompanyReply 'If the user company field matches this value it will be set as the default 'reply' signature
'Company properties
Public cName
Public cStreet
Public cBox
Public cPostal
Public cCity
Public cState
Public cCountry
Public cMail
Public cVat
Public cWebsite
Public cUrl
Public cLogo
Public cLogoPath
Public cPhone
Public cFax
'User properties
Public uName
Public uMail
Public uPhone
Public uCell
Public uFax
Public uTitle
Public uDepartment
Public uDisclaimer
Private Sub Class_Initialize()
me.sName = "The name of my signature"
me.sVersion = CDate("1/10/2012")
me.sTemplate = "Default.vbs"
me.cName = "MY COMPANY NAME"
me.cStreet = "Street"
me.cBox = "123"
me.cPostal = "ZIP"
me.cCity = "CITY"
me.cMail = "info#company.com"
me.cVat = "VAT NUMBER"
me.cWebsite = "www.company.com"
me.cUrl = "http://www.company.com"
me.cPhone = "+32 3 456 780"
me.cFax = "+32 3 456 789"
me.uName = "John Doe"
me.uPhone = "+32 3 456 780"
me.uFax = "+32 3 456 780"
End Sub
Public Property Get sPath()
sPath = oShell.ExpandEnvironmentStrings("%AppData%") + "\Microsoft\" & oShell.RegRead("HKCU\Software\Microsoft\Office\" & outlook_Version & "\Common\General\Signatures") & "\" & me.sName & ".htm"
End Property
End Class
Function SortArray(arrShort)
Dim i, j, temp
For i = UBound(arrShort) - 1 To 0 Step -1
For j= 0 To i
If arrShort(j)>arrShort(j+1) Then
temp=arrShort(j+1)
arrShort(j+1)=arrShort(j)
arrShort(j)=temp
End If
Next
Next
SortArray = arrShort
End Function
Function GetMembership(sChild, dMembership)
'Get AD info on the given Child
Set oChild = GetObject("LDAP://" & sChild)
If TypeName(oChild) = "Object" Then
'Add the Child's canonical name to the array IF it's a group
If TypeName(dMembership) = "Dictionary" Then
dMembership.Add oChild.distinguishedName, oChild.CN
Else
Set dMembership = CreateObject("Scripting.Dictionary")
End If
'If the Child has any parents (=groups), run the same loop for these parents.
If TypeName(oChild.memberOf) = "Variant()" Then
oParents = oChild.GetEx("memberOf")
For Each sParent in oParents
If Not dMembership.Exists(sParent) Then
Set dMembership = GetMembership(sParent, dMembership)
End If
Next
End If
End If
Set GetMembership = dMembership
End Function
Below the signature 'guide'. These scripts MUST have the same name as the group created in AD to work. When a user is a member of the AD group Signature-Marketing, it will run \\MyDomain.local\NETLOGON\Outlook\Signatures\Signature-Marketing.vbs
'\\MyDomain.local\NETLOGON\Outlook\Signatures\MyGroupName.vbs
'Set specific default values
Signature.sVersion = CDate("3/12/2012 15:35")
Signature.sName = "The name of my signature"
Signature.sCompanyNew = "MY COMPANY NAME"
Signature.sCompanyReply = "MY COMPANY NAME"
Signature.cName = "MY COMPANY NAME"
Signature.cStreet = "Street"
Signature.cBox = "123"
Signature.cPostal = "ZIP"
Signature.cCity = "City"
Signature.cMail = "info#company.com"
Signature.cVat = "VAT NUMBER"
Signature.cWebsite = "www.company.com"
Signature.cUrl = "http://www.company.com"
Signature.cLogo = "\\MyDomain.local\NETLOGON\Outlook\IMG\MyCompanyLogo.png"
Signature.cPhone = "+32 3 456 780"
Signature.cFax = "+32 3 456 789"
Signature.uName = "John Doe"
Signature.uPhone = "+32 3 456 780"
Signature.uFax = "+32 3 456 789"
Below the default template. This script gets evaluated within Outlook.vbs
'\\MyDomain.local\NETLOGON\Outlook\Templates\Default.vbs
oSelection.Font.Name = "Calibri"
oSelection.Font.Size = 11
oSelection.TypeText Signature.uName
If Not Signature.uTitle = "" Then
oSelection.TypeText Chr(11)
oSelection.TypeText Signature.uTitle
End If
If Not Signature.uDisclaimer = "" Then oSelection.TypeText " (*)"
' ### Add company table & info
oSelection.TypeParagraph()
Set tbl = oDoc.Tables.Add(oSelection.Range, 1, 2)
Set oTable = oDoc.Tables(1)
tWidth = oTable.Cell(1, 1).width + oTable.Cell(1, 2).width
' Add company logo to cell 1
Set oCell = oTable.Cell(1, 1)
Set oCellRange = oCell.Range
oCell.Select
Set oLogo = oSelection.InlineShapes.AddPicture(Signature.cLogo)
oLogo.LockAspectRatio = true
oLogo.height = oWord.PixelsToPoints(50)
oCell.width = oLogo.width
' Add company info to cell 2
If Signature.cVat = "" Then
arrAddressInfo = Array(Signature.cName, Signature.cStreet & " " & Signature.cBox, Signature.cPostal & " " & Signature.cCity)
Else
arrAddressInfo = Array(Signature.cName, Signature.cStreet & " " & Signature.cBox, Signature.cPostal & " " & Signature.cCity, Signature.cVat)
End If
strAddressInfo = Join(arrAddressInfo, " | ")
Set oCell = oTable.Cell(1, 2)
Set oCellRange = oCell.Range
oCell.Select
oCell.width = tWidth - oLogo.width
oSelection.Font.Size = 10
oSelection.TypeText strAddressInfo
' Add phone number information
arrUserInfo = Array()
If Not Signature.uPhone = "" Then
ReDim Preserve arrUserInfo(UBound(arrUserInfo) + 1)
arrUserInfo(UBound(arrUserInfo)) = "T " & Signature.uPhone
End If
If Not Signature.uCell = "" Then
ReDim Preserve arrUserInfo(UBound(arrUserInfo) + 1)
arrUserInfo(UBound(arrUserInfo)) = "G " & Signature.uCell
End If
If Not Signature.uFax = "" Then
ReDim Preserve arrUserInfo(UBound(arrUserInfo) + 1)
arrUserInfo(UBound(arrUserInfo)) = "F " & Signature.uFax
End If
strUserInfo = Join(arrUserInfo, " | ")
If Not strUserInfo = "" Then
oSelection.TypeText Chr(11)
oSelection.TypeText strUserInfo
End If
oSelection.TypeText Chr(11)
' Add user mail address to cell 2
Set oLink = oSelection.Hyperlinks.Add(oSelection.Range, "mailto:" & Signature.uMail, , , Signature.uMail)
oLink.Range.Font.Color = oSelection.Font.Color
oLink.Range.Font.Size = 10
' Add company weblink to cell 2
oSelection.TypeText " | "
Set oLink = oSelection.Hyperlinks.Add(oSelection.Range, Signature.cUrl, , , Signature.cWebsite)
oLink.Range.Font.Color = oSelection.Font.Color
oLink.Range.Font.Size = 10
If Not Signature.uDisclaimer = "" Then oSelection.TypeText " | (*) " & Signature.uDisclaimer
tbl.Rows(1).Cells.VerticalAlignment = 1
oTable.AutoFitBehavior(1)
\\MyDomain.local\NETLOGON\Outlook\PRF\Outlook_Cached.PRF
\\MyDomain.local\NETLOGON\Outlook\PRF\Outlook_NotCached.PRF
Create your own PRF file (quote from Microsoft TechNet):
To create a PRF file by using the Office Customization Tool
From the root of the network installation point, run the following command line to start the Office Customization Tool: \server\share\setup.exe /admin
To edit an existing customization file (.msp), in the Select Product dialog box, click Open an existing Setup customization file. Or to create a new customization file, select the Office suite that you want to customize, and then click OK.
In the Outlook area, click Outlook Profile. Select how you want to customize profiles for users. To specify settings to be included in a .prf file, choose Modify Profile or New Profile.
To add and configure new accounts or to modify or remove existing accounts, click Add accounts, and then click Customize additional Outlook profile and account information.
Once you complete the Outlook profile configurations, in the Outlook area, click Export settings.
Click the Export Profile Settings button to create a new .prf file. Enter a file name and the path on which to save the file, and then click Save.
The open source project GenerateSignatureFromLDAP can generate Outlook signatures based on a template and values taken from Active Directory.
This can be set in a startup script (e.g. via GPO).
The templates can contain "if" statements to modify the template based on specific criteria (e.g. the current date or an AD attribute like location).
See: https://sourceforge.net/projects/gensignfromldap/

How can I get a directory listing of DLLs with ProductName and ProductVersion?

When I look at a directory in Windows Explorer, I can see a ProductName and ProductVersion property for the DLL's in that directory.
I need to export this DLL list with ProductName and ProductVersion into a text file.
If I do c:\>dir *.dll > test.log, the test.log does not have the ProductName and ProductVersion.
Could someone help me to get these properties exported to a file along with the filename?
Even if it is a freeware tool or some other dir switch, that will be useful.
PowerShell is your friend here - and it's freely (as in beer) available from Microsoft.
The following is a one liner to spit out the product name, product version and file name of all the dlls in the windows directory into test.log:
dir c:\windows\*.dll | % {[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_)} | % { $_.ProductName + ", " + $_.ProductVersion + ", " + $_.FileName} > test.log
OK, so it's a long line - but it is still just one line at the command prompt.
PowerShell afficionados will probably be able to condense the above still further. Note that PowerShell allows us to use the .Net base class library (or even your own assemblies) such as System.Diagnostics.FileVersionInfo from the command line!
If you haven't played with PowerShell yet, you have a treat in store - particularly if you are a .Net developer :)
Using VBScript you could do the following:
Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.Namespace ("C:\Scripts")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim arrHeaders(40)
For i = 0 to 40
arrHeaders(i) = objFolder.GetDetailsOf (objFolder.Items, i)
Next
For Each strFileName in objFolder.Items
For i = 0 to 40
Wscript.echo arrHeaders(i) & ": " & objFolder.GetDetailsOf (strFileName, i)
Next
Wscript.Echo
Next
You can do this fairly easily with a .NET application.
using System;
using System.Diagnostics;
static class MainClass
{
static void Main(string[] args)
{
FileVersionInfo info = FileVersionInfo.GetVersionInfo("c:\\test.txt");
// Display version information.
Console.WriteLine("Checking File: " + info.FileName);
Console.WriteLine("Product Name: " + info.ProductName);
Console.WriteLine("Product Version: " + info.ProductVersion);
Console.WriteLine("Company Name: " + info.CompanyName);
}
}
Obviously, you'd have to add a function that retrieved all the files in a specified directory.
Adding a VB.Net version to the list:
Sub CreateLog(ByVal Logfile As String, ByVal PathToLog As String, Optional ByVal SearchPattern As String = "*.*")
Dim FileInfo As FileVersionInfo
Dim ret As String = ""
For Each File As String In IO.Directory.GetFiles(PathToLog, SearchPattern)
FileInfo = FileVersionInfo.GetVersionInfo(File)
If FileInfo.ProductName & FileInfo.ProductVersion <> "" Then
ret &= FileInfo.ProductName & ", " & FileInfo.ProductVersion & vbCrLf
End If
Next
IO.File.WriteAllText(Logfile, ret)
End Sub
Call it by: CreateLog("c:\log.txt", "c:\windows", "*.dll")
Edit:Added searchpattern.
I cannot speak to this software at all, but this appears to do what you're looking for:
http://www.softpedia.com/get/Programming/Other-Programming-Files/STRFINFO.shtml
SYNTAX
~~~~~~
StrFInfo[.EXE] ExeDllOcxFileName [Property1 [Property2 ...]]
COMMON PROPERTIES
~~~~~~~~~~~~~~~~~
FileDescription FileVersion InternalName
OriginalFileName ProductName ProductVersion
CompanyName LegalCopyRight $Translation
Interesting, I didn't know this GetDetailsOf function.
I wondered about the arbitrary size...
I am not sure what is the limit, which seem to vary between folders or at least user settings or something, so I made something more flexible:
Set shell = CreateObject("Shell.Application")
Set folder = shell.Namespace("D:\Documents")
Set fso = CreateObject("Scripting.FileSystemObject")
For Each fileName in folder.Items
i = 0
emptyNb = 0
Do
detail = folder.GetDetailsOf(folder.Items, i)
If detail = "" Then
emptyNb = emptyNb + 1
Else
detailValue = folder.GetDetailsOf(fileName, i)
If detailValue <> "" Then
Wscript.Echo i & " " & detail & ": " & detailValue
End If
emptyNb = 0
End If
i = i + 1
Loop While emptyNb < 3 ' Arbirary, adjust as you see fit
detailValue = folder.GetDetailsOf(fileName, -1)
If detailValue <> "" Then
Wscript.Echo "Tooltip:" & vbCrLf & detailValue
End If
Wscript.Echo
Next
To answer the question, you can check when detail is equal to the info you are looking for and only display these values.

Resources