none
App-V Upgrade from <4.6 to 4.6+ for OSD files

    General discussion

  • Not sure if this is useful to many but with thousands of OSD's I wrote the following script to do it for me. Pre 4.6 versions did not have some of the newer OS's, since all of our apps are sequenced with pre 4.6 we did not have the tags in the OSD files. As more and more people were coming up on Win7 and 2008 TS we were missing apps. The following script will add the missing OS Tags to all your OSD's in the content folder. It has a little logic in it where if the app is only for TS's then it will only update with TS tags, and the same for PC's or Servers. I strongly recommend making a backup of your OSD's first.

     

    on error resume next
    Dim filesys, ContentPath, subfol, folcoll, folist
    Dim WinVerArray(13)
    WinNameArray=Array("", "Win2003TS", "Win2003TS64", "Win2008R2TS64", "Win2008TS", "Win2008TS64", "Win7", "Win764", "WinVista", "WinVista64", "WinXP", "WinXP64", "Win2003Svr", "Win2008Svr")

    '1 = Win2003TS
    '2 = Win2003TS64
    '3 = Win2008R2TS64
    '4 = WIN2008TS
    '5 = WIN2008TS64
    '6 = Win7
    '7 = Win764
    '8 = WinVista
    '9 = WinVista64
    '10 = WinXP
    '11 = WinXP64
    '12 = Win2003Svr
    '13 = Win2008Svr

    ContentPath = "<put the path of your content folder here>"
    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set ContentFolder = filesys.GetFolder(ContentPath)
    Set folcoll = ContentFolder.SubFolders

    For Each subfol in folcoll
     Set filecoll = subfol.Files
     For Each fil in filecoll
      For i=1 To 13
       WinVerArray(i)=0
      Next
      x=0
      if lcase(right(fil.name, 3))="osd"  Then
       Set readfile = filesys.OpenTextFile(fil.path, 1, false)
       while not readfile.atendofstream
        tmp = readfile.ReadLine
        If Left(replace(UCase(tmp), VBTAB, ""),10)="<OS VALUE=" And x=0 Then
         For i=1 To 13
          If UCase(tmp)=VBTAB & VBTAB & "<OS VALUE=" & Chr(34) & UCase(WinNameArray(i)) & Chr(34) & "/>" Then
           WinVerArray(i)=1
          end if
         Next
        End If
       Wend
       y=0
       For i=1 To 13
        y=WinVerArray(i)+y
       Next
       readfile.close
       Set readfile = filesys.OpenTextFile(fil.path, 1, false)
       while not readfile.atendofstream
        tmp = readfile.ReadLine
        If Left(replace(UCase(tmp), VBTAB, ""),10)="<OS VALUE=" And x=0 Then
    ''''''''''Terminal Servers
         If WinVerArray(1) = 1 Or WinVerArray(2) = 1 Or WinVerArray(3) = 1 Or WinVerArray(4) = 1 Or WinVerArray(5) = 1 Then
           For i=1 To 5
             NewOSD = NewOSD & VBTAB & VBTAB & "<OS VALUE=" & Chr(34) & WinNameArray(i) & Chr(34) & "/>" & VBCRLF
           Next
         End If
    ''''''''''PC
         If WinVerArray(6) = 1 Or WinVerArray(7) = 1 Or WinVerArray(8) = 1 Or WinVerArray(9) = 1 Or WinVerArray(10) = 1  Or WinVerArray(11) = 1 Then
           For i=6 To 11
             NewOSD = NewOSD & VBTAB & VBTAB & "<OS VALUE=" & Chr(34) & WinNameArray(i) & Chr(34) & "/>" & VBCRLF
           Next
         End If
    ''''''''''Server  
         If WinVerArray(12) = 1 Or WinVerArray(13) = 1 Then
           For i=12 To 13
             NewOSD = NewOSD & VBTAB & VBTAB & "<OS VALUE=" & Chr(34) & WinNameArray(i) & Chr(34) & "/>" & VBCRLF
           Next
         End If
         x=1
        ElseIf Left(replace(UCase(tmp), VBTAB, ""),10)="<OS VALUE=" And x=1 Then
         'do nothing
        ElseIf Left(replace(UCase(tmp), VBTAB, ""),10)="<VM VALUE=" And x=0 And y=0 Then
           For i=1 To 13
             NewOSD = NewOSD & VBTAB & VBTAB & "<OS VALUE=" & Chr(34) & WinNameArray(i) & Chr(34) & "/>" & VBCRLF
           Next
           NewOSD = NewOSD & tmp & VBCRLF
           x=1
        Else
         NewOSD = NewOSD & tmp & VBCRLF
        End If
       Wend
       readfile.close
       set writefile = filesys.createtextfile(fil.path, True)
       filesys.DeleteFile fil.path
       writefile.write NewOSD
       writefile.close
       NewOSD=""
      End If
     Next
    Next
    MsgBox "COMPLETE"

     


    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.
    Wednesday, May 25, 2011 2:45 PM

All replies