counter hit make
Softgrid 4.1 migration towards ConfigMgr with App-V 4.6 Integration : The story of automation , Part 4. - sccm

SCCM - System Center Configuration Manager

Blog about SCCM 2007 aka SMS v4

Recent Posts

Tags

News

Community

Email Notifications

    Blogs

    Archives

    Softgrid 4.1 migration towards ConfigMgr with App-V 4.6 Integration : The story of automation , Part 4.

    Today , I will continue explaining my little migration project to migrate away from a standalone Softgrid 4.1 infrastructure towards a fully integrated SCCM2007 SP R2 App-V 4.6 infrastructure . You can read my previous posts right here :

     

    Below I will discuss the migration scenario once more in a few bullet points to migrate away from the Softgrid 4.1 standalone environment :

    1. Deploy the new app-V 4.6 clients on all workstations and check for inconsistencies (luckily all packages where sequenced with 4.2) DONE in Part 1.

    2. Pull all existing Softgrid 4.2 sequenced packages thru the new App-V 4.6 Sequencer to avoid any complications. DONE in Part 1.

    3. Import all packages into ConfigMgr 2007 SP2 R2 DONE in Part 1.

    4. Create all necessary collections and create a dynamic membership query with a AD group name. Partially explained in Part 2 , DONE in Part 3.

    5. Create all the necessary advertisements.

    6. Switch over from Softgrid standalone to Configmgr 2007 R2 SP2. (Think about network impact !)

     

    So that will leave us to creating all the necessary advertisments (remember 400 Pieces) between the virtual Packages and the necessary collections.

    As explained in Part 3, we have created a CSV file with all the necessary information as APP-V package Name , ResourceID & Collection Names. Now we need to add the PackageID , Advertisement Name and CollectionID to the CSV file  ( you can extract that kind of information out of your SQL DB (dbo.v_Package & dbo.v_collections)

    image

    Figure 1: The modified CSV file added with PackageID, Advertisement Name, CollectionID

    Once the CSV file is filled up with the necessary data , we can start working on the script to create those advertisements based on that Csv file , as we need the PackageID , CollectionID and Advertisment Name tables to make it work .

    Below I will post the VBS code to read out the csv file and create all advertisements :

       1: set fs = CreateObject("Scripting.FileSystemObject")
       2: dim arrStr
       3: set objTextFile = fs.OpenTextFile("E:\Virtualpkg\AppvPackageNameResourceId_Advertisment.csv")
       4:  
       5: Do while NOT objTextFile.AtEndOfStream
       6:   arrStr = split(objTextFile.ReadLine,";")
       7:   advPackageID = arrStr(1)
       8:   advCollection = arrStr(5)
       9:   advName = arrStr(4)
      10:  
      11:  
      12:   
      13:   strSMSServer = "CMSRV.uza.local"
      14:   advProgramName = "[Virtual Application]"
      15:   'advAssignedSchedule = "16/11/2010 16:25 AM"
      16:   'advAssignedScheduleExpire = "12/04/2010 12:59 AM"
      17:  
      18: ' MsgBox "advnaam ="& advname &" en coll="& advCollection &" en packageid=" &advPackageID
      19:  
      20:  
      21:  
      22: Set objLoc =  CreateObject("WbemScripting.SWbemLocator")
      23: Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms")
      24: Set Results = objSMS.ExecQuery _
      25:     ("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true")
      26: For each Loc in Results
      27:     If Loc.ProviderForLocalSite = True Then
      28:         Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _
      29:             Loc.SiteCode)
      30:             strSMSSiteCode = Loc.Sitecode
      31:     end if
      32: Next
      33:  
      34: Set newAdvert = objSMS.Get("SMS_Advertisement").SpawnInstance_()
      35: newAdvert.AdvertisementName = advName
      36: newAdvert.CollectionID = advCollection
      37: newAdvert.PackageID = advPackageID
      38: newAdvert.ProgramName = advProgramName
      39: 'newAdvert.ExpirationTime = ConvertToWMIDate(advAssignedScheduleExpire)
      40: newAdvert.ExpirationTimeEnabled = False
      41: 'newAdvert.advertflags = 25
      42: newAdvert.PresentTime = ConvertToWMIDate(Now())
      43: newAdvert.RemoteClientFlags = &H846
      44: newAdvert.Priority = 1
      45:  
      46: path = newAdvert.Put_
      47: wscript.echo path
      48: Set objAdvert=objSMS.Get(path)
      49: strAdvertID =  objAdvert.AdvertisementID
      50:  
      51: 'create a non-recurring schedule token
      52: Set instToken = objSMS.Get("SMS_ST_NonRecurring").SpawnInstance_()
      53: instToken.StartTime = ConvertToWMIDate(advAssignedSchedule) 
      54: instToken.DayDuration = 0
      55: instToken.HourDuration = 0
      56: instToken.MinuteDuration = 0
      57: instToken.IsGMT = False
      58: retval = AddSchedToken(instToken, strAdvertID)
      59:  
      60: Loop
      61:  
      62: objTextFile.Close
      63: set objTextFile = Nothing
      64: set fs = Nothing
      65:  
      66: Function AddSchedToken(objSchedToken, strAdvertID)
      67:     'enlarge the current schedule array by 1
      68:     Set objAdvert=objSMS.Get _
      69:         ("SMS_Advertisement.AdvertisementID='" & strAdvertID & "'")
      70:     WScript.Echo(objAdvert.AdvertisementID)
      71:     
      72:     Dim newScheduleArray(0)
      73:     Set newScheduleArray(0) = objSchedToken
      74:     
      75:     'add the new assignment
      76:     objAdvert.AssignedSchedule = newScheduleArray
      77:     objadvert.AssignedScheduleEnabled = True
      78:     AddSchedToken = objAdvert.Put_
      79: End Function
      80:  
      81: Function ConvertToWMIDate(strDate)
      82:     'Convert from a standard date time to wmi date
      83:     '4/18/2005 11:30:00 AM = 2005041811300.000000+*** 
      84:     strYear = year(strDate):strMonth = month(strDate)
      85:     strDay = day(strDate):strHour = hour(strDate)
      86:     strMinute = minute(strDate)
      87:     'Pad single digits with leading zero
      88:     if len(strmonth) = 1 then strMonth = "0" & strMonth
      89:     if len(strDay) = 1 then strDay = "0" & strDay
      90:     if len(strHour) = 1 then strHour = "0" & strHour
      91:     if len(strMinute) = 1 then strMinute = "0" & strMinute
      92:     ConvertToWMIDate = strYear & strMonth & strDay & strHour _
      93:         & strMinute & "00.000000+***"
      94: end function
      95:  
      96:  
      97:  
      98:  
      99:  
     100:  

     

    Stay tuned for Part 5 very soon talking about the actual switch over from Softgrid standalone to Configmgr 2007 R2 SP2. ….

     

    Hope it Helps ,

    Kenny Buntinx