Is this really the case? That I have to manually recreate everything from my
old SMS environment?
Thanks!
Build a new 2K3 site, upgrade the 2.0 site to 2K3, connect the new 2K3 site
to the former 2.0 (now 2K3) site. Now export the objects from the former
2.0 site will replicate into the new site and then disconnect the site.
Then decommission the old site.
--
Richard Threlkeld
Microsoft MVP - SMS
http://myitforum.techtarget.com/blog/rthrelkeld/
"Mikey" <Mi...@discussions.microsoft.com> wrote in message
news:9AE5FAF1-4885-4B9A...@microsoft.com...
If you sent me an email at kimoppalfe...@tiscali.be, I will reply
with a vbs script I created to export package definition files from a
server.
I used this in a test environment to export packages, and reimport them.
If you would like to take if for a test run, I would be more than happy
to sent it to you.
Keep in mind that this has undergone very limited to no testing at all.
Kim
In article <9AE5FAF1-4885-4B9A...@microsoft.com>,
Mi...@discussions.microsoft.com says...
--
Kim Oppalfens
Proud father of Lennart Oppalfens
Since 05/11/2004 08.53 GMT+1
We have a location that created an SMS 2003 primary site independent of the
Corporate requirements. We want to create a new SMS site and migrate the
packages and collections of the old environment to the new. I checked
MyITForum but it was for SMS 2.0 PDFs. I wasn't sure if it would be
compatible with SMS 2003.
Thanks for your help
Terri
I saw your post regard a script that you created that will export old items
from a SMS 2.0 site to a new SMS 2003 site. I would be forever grateful if
you could share this with me as we are undergoing the same sort of migration
with little to no success.
Thanks
Robert Ronan
'///////////////////////////////////////////////////////////////////////////////
'// Export Package to PDF
'// Created by: Brian Howson
'// Usage: change SmsSite and SmsServer to your site and server
'// This script will create a SMS 2.0 .sms file to import somewhere
'// at a different site.
'// useful for moving Packages from site to site
'//
'// You can freely use this script so long as you send me a copy of
'// all PDF's you export with this script to brian....@bbh.com :)
'//
'///////////////////////////////////////////////////////////////////////////////
'
'
'REGEDIT4
'
'[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\NodeTypes\{3AD39FC7-EFD601D0-BDCF-00A0C909FDD7}
\Extensions\SMS_Tools]
'
'[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\NodeTypes\{3AD39FC7-EFD601D0-BDCF-00A0C909FDD7}
\Extensions\SMS_Tools\PDFExport]
'"Name"="PDFExport"
'"Description"="Export Package to PDF"
'"CommandLine"="cscript //NoLogo d:\\download\\wsh\\exppdf.vbs ##SUB:__PATH##"
'
'**Start Encode**
' ##__Path## comes back as:
' \\NJ01TS04\root\sms\site_SDR:SMS_Package.PackageID=SDR0001F
Set objArgs = WScript.Arguments
if (objArgs.count > 0) then
MyPos = InStr(objArgs(0), ":")
SmsPath = Left(objArgs(0), MyPos - 1)
SmsPackage = right(objArgs(0), 8)
else
SmsPath = "\\<servername>\root\sms\site_<site code>"
SmsPackage = "<Package Id>"
end if
Dim Shell
Dim System
Dim oFile
Dim Flags(32)
Set Shell = CreateObject("Wscript.Shell")
Set System = CreateObject("Scripting.FileSystemObject")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1
Const ForWriting = 2
CRLF = Chr(13) & Chr(10)
winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!" & _
SmsPath
' SmsServer & "\root\sms\site_" & SmsSite
'///////////////////////////////////////////////////////////////////////////////
'//Echo your connection then get the object
'///////////////////////////////////////////////////////////////////////////////
'// oFile.WriteLine winmgmt1
Set SystemSet = GetObject( winmgmt1 )
'///////////////////////////////////////////////////////////////////////////////
'// Create Query String
'///////////////////////////////////////////////////////////////////////////////
strQuery = "select PackageID, Name, Version, Icon, Description, " & _
"LastRefreshTime, SourceSite, Manufacturer, Language, " & _
"PkgSourceFlag, PkgSourcePath, " & _
"MIFFilename, MIFName, MIFPublisher, MIFVersion from " & _
"SMS_Package where PackageID = '" & SmsPackage & "'"
'///////////////////////////////////////////////////////////////////////////////
'// Create Query Connection
'///////////////////////////////////////////////////////////////////////////////
Set objEnumerator = SystemSet.ExecQuery(strQuery)
'///////////////////////////////////////////////////////////////////////////////
'// Loop through all results and echo to screen
'///////////////////////////////////////////////////////////////////////////////
for each instance in objEnumerator
fname = "D:\temp\" & instance.PackageID &".sms"
' fname = InputBox( "Enter File Name", "Save as...", fname)
Set oFile = System.OpenTextFile(fname, ForWriting, True)
WScript.Echo "Creating " & fname &" for " & instance.Name
oFile.WriteLine ""
oFile.WriteLine "[PDF]"
oFile.WriteLine "VERSION=2.0"
oFile.WriteLine ""
oFile.WriteLine "[Package Definition]"
'// NAME - Required - up to 50 characters
oFile.WriteLine "Name=" & instance.Name
'// VERSION - up to 32 characters
if (len(instance.Version ) > 0) then
oFile.WriteLine "Version=" & instance.Version
end if
'// TODO: ICON comes back as actual Icon data. If the data exists,
'// save in ICO file (?), then put icon file name in value.
'// ICON - file name of icon file (must be in same dir as PDF when you import)
'// Icon returned as an array of Variants
' wscript.echo "Type " & Vartype(instance.icon)
' if (instance.Icon <> NULL) then
' oFile.WriteLine "Icon=" & instance.Icon
' end if
'// PUBLISHER - Required - up to 32 characters
oFile.WriteLine "Publisher=" & instance.Manufacturer
'// LANGUAGE - Required
oFile.WriteLine "Language=" & instance.Language
'// COMMENT - not required, up to 127 charaters
if (len(instance.Description) > 0) then
oFile.WriteLine "Comment=" & instance.Description
end if
'// PkgSourceFlag - not required
oFile.WriteLine "PkgSourceFlag=" & instance.PkgSourceFlag
'// PkgSourcePath - not required
oFile.WriteLine "PkgSourcePath=" & instance.PkgSourcePath
'// MIFFILENAME
if (len(instance.MIFFilename) > 0) then
oFile.WriteLine "MIFfilename=" & instance.MIFFilename
end if
'// MIFNAME
if (len(instance.MIFName) > 0) then
oFile.WriteLine "MIFName=" & instance.MIFName
end if
'// MIFPUBLISHER
if (len(instance.MIFPublisher) > 0) then
oFile.WriteLine "MIFPublisher=" & instance.MIFPublisher
end if
'// MIFVERSION
if (len(instance.MIFVersion) > 0) then
oFile.WriteLine "MIFVersion=" & instance.MIFVersion
end if
'///////////////////////////////////////////////////////////////////////////////
prgQuery = "select PackageID, ProgramName from SMS_Program where PackageID
= '" & _
instance.PackageID & "'"
Set prgEnumerator = SystemSet.ExecQuery(prgQuery)
'///////////////////////////////////////////////////////////////////////////////
'// Create Programs= line by putting program names in comma delimited list
'///////////////////////////////////////////////////////////////////////////////
proglist = ""
for each prog in prgEnumerator
if (len(proglist) > 0) then
proglist = proglist & ", " & prog.ProgramName
else
proglist = prog.ProgramName
end if
next
oFile.WriteLine "Programs=" & proglist
'///////////////////////////////////////////////////////////////////////////////
'// Loop through each program and output parameters
'///////////////////////////////////////////////////////////////////////////////
for each prog in prgEnumerator
set progobj = SystemSet.Get(prog.Path_)
'///////////////////////////////////////////////////////////////////////////////
'// parse ProgramFlags to attributes below
'///////////////////////////////////////////////////////////////////////////////
For loopcounter = 12 To 29 Step 1
If ((progobj.ProgramFlags And 2 ^ loopcounter) = (2 ^ loopcounter))
Then
Flags(loopcounter) = 1
Else
Flags(loopcounter) = 0
End If
Next '// for loopcounter
oFile.WriteLine ""
'// PROGRAMNAME
oFile.WriteLine "[" & progobj.ProgramName & "]"
'// NAME
oFile.WriteLine "Name=" & progobj.ProgramName
'// ICON
' if (len(progobj.Icon) > 0) then
' oFile.WriteLine "Icon=" & progobj.Icon
' end if
'// COMMENT
if (len(progobj.Description) > 0) then
oFile.WriteLine "Comment=" & progobj.Description
end if
'// COMMANDLINE
oFile.WriteLine "CommandLine=" & progobj.CommandLine
'// STARTIN
if (len(progobj.WorkingDirectory) > 0) then
oFile.WriteLine "StartIn=" & progobj.WorkingDirectory
end if
'// RUN - specifies run mode for program
if Flags(22) = 1 then
oFile.WriteLine "Run=Minimized"
elseif Flags(23) = 1 then
oFile.WriteLine "Run=Maximized"
elseif Flags(24) = 1 then
oFile.WriteLine "Run=Hidden"
else
oFile.WriteLine "Run=Normal"
end if
'// AFTERRUNNING - note, if entry missing, no action performed
if Flags(18) = 1 then
oFile.WriteLine "AfterRunning=ProgramRestart"
elseif Flags(19) = 1 then
oFile.WriteLine "AfterRunning=SMSRestart"
elseif Flags(25) = 1 then
oFile.WriteLine "AfterRunning=SMSLogoff"
end if
'// ESTIMATEDDISKSPACE - if entry missing defaults to 'UNKNOWN', include KB
or MB.
if (len(progobj.DiskSpaceReq) > 0) then
oFile.WriteLine "EstimatedDiskSpace=" & progobj.DiskSpaceReq
end if
'// ESDTIMATEDRUNTIME - in minutes, if entry missing defaults to 'UNKNOWN'
if (len(progobj.Duration) > 0) then
oFile.WriteLine "EstimatedRunTime=" & progobj.Duration
end if
'// ENABLERUNTIMEMONITORING - notifies user if time exceeded by 15 minutes
if Flags(28) = 1 then
oFile.WriteLine "EnableRunTimeMonitoring=True"
else
oFile.WriteLine "EnableRunTimeMonitoring=False"
end if
'// ADDITIONALPROGRAMREQUIREMENTS - comment seen by administrators and users
if (len(progobj.Requirements) > 0) then
oFile.WriteLine "AdditionalProgramRequirements=" &
progobj.Requirements
end if
'// CANRUNWHEN - application install dependent on user logged on or not.
if Flags(14) = 1 then
oFile.WriteLine "CanRunWhen=UserLoggedOn"
elseif Flags(17) = 1 then
oFile.WriteLine "CanRunWhen=NoUserLoggedOn"
else
oFile.WriteLine "CanRunWhen=AnyUserStatus"
end if
'// USERINPUTREQUIRED - specify whether user must interact with program
if Flags(14) = 1 then
oFile.WriteLine "UserInputRequired=False"
else
oFile.WriteLine "UserInputRequired=True"
end if
'// ADMINRIGHTSREQUIRED - specify program elevated to administrator
if Flags(15) = 1 then
oFile.WriteLine "AdminRightsRequired=True"
end if
'// USEINSTALLACCOUNT - use Windows NT Client Software installation account
if Flags(26) = 1 then
oFile.WriteLine "UseInstallAccount=True"
end if
'// DRIVELETTERCONNECTION - program requires a drive letter connection to
package share
if Flags(20) = 1 then
oFile.WriteLine "DriveLetterConnection=False"
else
oFile.WriteLine "DriveLetterConnection=True"
end if
'// SPECIFYDRIVE - drive letter to connect as (if DRIVELETTERCONNECTION True)
if (len(progobj.DriveLetter) > 0) then
oFile.WriteLine "SpecifyDrive=" & progobj.DriveLetter
end if
'// RECONNECTDRIVEATLOGON - makes drive connection persistent
if Flags(21) = 1 then
oFile.WriteLine "ReconnectDriveAtLogon=True"
end if
'// DEPENDENTPROGRAM - another program in this package to run first
if (len(progobj.DependentProgram) > 0) then
oFile.WriteLine "DependentProgram=" & progobj.DependentProgram
end if
'// ASSIGNMENT - assign to the first or every user of machine
if Flags(16) = 1 then
oFile.WriteLine "Assignment=EveryUser"
else
oFile.WriteLine "Assignment=FirstUser"
end if
'// DISABLED - Whether program can be run and/or displayed to clients
if Flags(12) = 1 then
oFile.WriteLine "Disabled=True"
end if
'// REMOVEPROGRAM - whether program uninstalled when no longer advertised.
if Flags(29) = 1 then
oFile.WriteLine "RemoveProgram=True"
' requires entry for UninstallKey=
end if
'// UNINSTALLKEY - key containing uninstall information for package
if (len(progobj.RemovalKey) > 0) then
oFile.WriteLine "UninstallKey=" & progobj.RemovalKey
end if
'///////////////////////////////////////////////////////////////////////////////
'// Logic for Platform requirements
'///////////////////////////////////////////////////////////////////////////////
if Flags(27) = 0 then ' Only execute if ANY_PLATFORM(27) is False
progSupp = ""
progPlatform = ""
progMinMax = ""
for each progos in progobj.SupportedOperatingSystems
progPlatform = progos.name & " (" & progos.Platform & ")"
if (Instr(progSupp, progPlatform) = 0) then
if (len(progSupp) > 0) then
progSupp = progSupp & ", "
end if
progSupp = progSupp & progPlatform
progCount = 1
progMinMax = progMinMax & progPlatform & "MinVersion" &
progCount & "=" &
progos.MinVersion & CRLF
progMinMax = progMinMax & progPlatform & "MaxVersion" &
progCount & "=" &
progos.MaxVersion & CRLF
else
progCount = progCount + 1
progMinMax = progMinMax & progPlatform & "MinVersion" &
progCount & "=" &
progos.MinVersion & CRLF
progMinMax = progMinMax & progPlatform & "MaxVersion" &
progCount & "=" &
progos.MaxVersion & CRLF
end if
Next
oFile.WriteLine "SupportedClients=" & progSupp
oFile.WriteLine progMinMax
end if ' ANY_PLATFORM(27)
Next ' program
oFile.WriteLine ""
oFile.WriteLine ""
oFile.WriteLine ""
'// Warning, the next line will refresh the files in your package
'// This is a cool trick for an unattended refresh!
'// RetCode = instance.RefreshPkgSource
oFile.close
Next ' package
Wscript.Quit(0)
'///////////////////////////////////////////////////////////////////////
////////
'// Export All Queries to TXT
'// Created by: Kim Oppalfens (MVP SMS)
'///////////////////////////////////////////////////////////////////////
Option Explicit
Dim objArgs, Command, qryfile, Sitecode, strSiteServer
Dim objFSO, WmiQuery, objWmiService, query, colQuery, oFile
Dim Line, queryexpression
Dim qryParameters, newquery
Set objArgs = WScript.Arguments
if (objArgs.count > 2) then
Command = Wscript.arguments.item(0)
Qryfile = Wscript.arguments.item(1)
Sitecode = wscript.arguments.item(2)
If (objArgs.count = 3) then
strSiteServer = "."
Else
strSiteServer = wscript.arguments.item(3)
End If
else
Wscript.echo("Usage: migratequeries.vbs IMPORT|EXPORT20|EXPORT2003
File SITECODE [SITESERVER]")
Wscript.echo("Example: migratequeries.vbs EXPORT2003 c:\expqueries.txt
S01 SMSSVR01")
Wscript.echo("")
Wscript.echo("IMPORT|EXPORT20|Choose whether you want to import or
export queries")
Wscript.echo("EXPORT2003, EXPORT20 will export to format for
reimporting to sms 2.0")
Wscript.echo(" EXPORT2003 will export to format for
reimporting to sms 2003")
Wscript.echo("File, Filename of the textfile where to
import/export queries")
Wscript.echo(" to/from")
Wscript.echo("SITECODE, 3-char SMS sitecode of the site for which you
want to ")
Wscript.echo(" import/export queries")
Wscript.echo("SITESERVER, Name of the SMS siteserver you want to
export packages from.")
Wscript.echo(" Default is Local Server")
Wscript.Quit(1)
end if
Set objFSO = Createobject ("Scripting.filesystemobject")
If ucase(command) = "EXPORT20" OR ucase(command) = "EXPORT2003" Then
WmiQuery = "select * from sms_query where limittocollectionid = " & CHR
(34) & CHR(34) & _
"And queryid like " & CHR(34) & sitecode & "%" & CHR(34)
Set objWMIService = GetObject ("Winmgmts:
{impersonationlevel=impersonate}!\\" & _
strSiteServer & "\root\sms\site_" & sitecode)
Set colquery = objWMIService.Execquery(wmiQuery)
Set oFile = objFSO.CreateTextFile(qryfile,TRUE)
For Each query in colquery
If ucase(command) = "EXPORT20" Then
queryexpression = query.Expression
Else
queryexpression = replace
(query.Expression,"SMS_G_System_ADDREMPROGS","SMS_G_System_ADD_REMOVE_PR
OGRAMS")
End If
line = query.name & ";" & _
query.comments & ";" & _
query.limittocollectionid & ";" & _
query.TargetClassname & ";" & _
queryexpression
Wscript.echo line
ofile.WriteLine Line
Next
ofile.close
End If
If ucase(command) = "IMPORT" Then
set objfso = Createobject ("Scripting.filesystemobject")
Set ofile = objfso.opentextfile (qryfile,1)
Set objWMIService = GetObject ("Winmgmts:
{impersonationlevel=impersonate}!\\" & _
strSiteServer & "\root\sms\site_" & sitecode)
Do While NOT ofile.atendofstream
line = ofile.readline
QryParameters = Split (line,";",-1,1)
Set newquery = objWMIService.get("SMS_Query").SpawnInstance_()
newquery.name = Qryparameters(0)
newquery.comments = Qryparameters(1)
newquery.limittocollectionid = Qryparameters(2)
newquery.TargetClassname = Qryparameters(3)
newquery.Expression = Qryparameters(4)
newquery.put_
WScript.echo newquery.name & " was imported"
Loop
ofile.close
End if
In article <35D9B539-638D-4AF3...@microsoft.com>,
Te...@discussions.microsoft.com says...
--
Kim Oppalfens
SMS MVP
'///////////////////////////////////////////////////////////////////////
////////
'// Export Packages to PDF
'// This script will create SMS 2.0 .sms files to import somewhere
'// at a different site.
'//
'// Created by: Brian Howson
'// Modified by Kim Oppalfens (MVP SMS)
'///////////////////////////////////////////////////////////////////////
////////
'
'
Dim Shell
Dim strSiteServer
Dim System
Dim oFile
Dim Flags(32)
Dim starttime
Set Shell = CreateObject("Wscript.Shell")
Set System = CreateObject("Scripting.FileSystemObject")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1
Const ForWriting = 2
CRLF = Chr(13) & Chr(10)
Set objArgs = WScript.Arguments
if (objArgs.count > 0) then
Sitecode = wscript.arguments.item(0)
If (objArgs.count = 1) then
strSiteServer = "."
Else
strSiteServer = wscript.arguments.item(1)
End If
else
Wscript.echo("Usage: exportpkg.vbs SITECODE [SITESERVER]")
Wscript.echo("Example: exportpkg.vbs S01 SMSSVR01")
Wscript.echo("")
Wscript.echo("SITECODE, 3-char SMS sitecode of the site you want to
export packages")
Wscript.echo(" from.")
Wscript.echo("SITESERVER, Name of the SMS siteserver you want to
export packages from.")
Wscript.echo(" Default is Local Server")
Wscript.Quit(1)
end if
winmgmt1 = "winmgmts:\\" & strSiteServer & "\root\sms\site_" & sitecode
pkgcount = 0
'///////////////////////////////////////////////////////////////////////
////////
'//Echo your connection then get the object
'///////////////////////////////////////////////////////////////////////
////////
Set SystemSet = GetObject( winmgmt1 )
'///////////////////////////////////////////////////////////////////////
////////
'// Create Query String
'///////////////////////////////////////////////////////////////////////
////////
strQuery = "select PackageID, Name, Version, Icon, Description, " & _
"LastRefreshTime, SourceSite, Manufacturer, Language, " & _
"MIFFilename, MIFName, MIFPublisher, MIFVersion from
SMS_Package "
'///////////////////////////////////////////////////////////////////////
////////
'// Create Query Connection
'///////////////////////////////////////////////////////////////////////
////////
Starttime = Time
Set objEnumerator = SystemSet.ExecQuery(strQuery)
'///////////////////////////////////////////////////////////////////////
////////
'// Loop through all results and echo to screen
'///////////////////////////////////////////////////////////////////////
////////
foldername = InputBox( "Enter Folder Name eg c:\pdffiles ", "Save
as...", foldername)
for each instance in objEnumerator
fname = foldername &"\"& instance.PackageID &".sms"
Set oFile = System.OpenTextFile(fname, ForWriting, True)
WScript.Echo "Creating " & fname &" for " & instance.Name
oFile.WriteLine ""
oFile.WriteLine "[PDF]"
oFile.WriteLine "VERSION=2.0"
oFile.WriteLine ""
oFile.WriteLine "[Package Definition]"
'// NAME - Required - up to 50 characters
oFile.WriteLine "Name=" & instance.Name
'// VERSION - up to 32 characters
if (len(instance.Version ) > 0) then
oFile.WriteLine "Version=" & instance.Version
end if
'// TODO: ICON comes back as actual Icon data. If the data exists,
'// save in ICO file (?), then put icon file name in value.
'// ICON - file name of icon file (must be in same dir as PDF when you
import)
'// Icon returned as an array of Variants
' wscript.echo "Type " & Vartype(instance.icon)
' if (instance.Icon <> NULL) then
' oFile.WriteLine "Icon=" & instance.Icon
' end if
'// PUBLISHER - Required - up to 32 characters
if (len(instance.Manufacturer) = 0) then
oFile.WriteLine "Publisher=unknown"
Else
oFile.WriteLine "Publisher=" & instance.Manufacturer
end if
'// LANGUAGE - Required
if (len(instance.Language) = 0) then
oFile.WriteLine "Language=English"
Else
oFile.WriteLine "Language=" & instance.Language
end if
'// COMMENT - not required, up to 127 charaters
if (len(instance.Description) > 0) then
oFile.WriteLine "Comment=" & instance.Description
end if
'// MIFFILENAME
set progobj = SystemSet.Get(prog.Path_)
oFile.WriteLine ""
'// COMMENT
if (len(progobj.Comment) > 0) then
oFile.WriteLine "Comment=" & progobj.Comment
end if
if Flags(13) = 1 then
oFile.WriteLine ""
oFile.WriteLine ""
oFile.WriteLine ""
oFile.close
pkgcount = pkgcount +1
Next ' package
Wscript.echo "Started at: " & starttime
Endtime = Time
Wscript.echo "Stopped at:" & endtime
line = DateDiff("s",starttime,endtime)
Wscript.echo "Exported " & pkgcount & " packages in " & line & "
Seconds"
Wscript.Quit(0)
In article <35D9B539-638D-4AF3...@microsoft.com>,
Te...@discussions.microsoft.com says...
--
Kim Oppalfens
SMS MVP
Do you know of any progamatic way of exporting and importing collections or
adverts
Collections are trikier since you can't recreating the collection
memberships for direct membership collections until all clients have
been migrated. Query based collections should be feasible.
Kim Oppalfens
MVP SMS
In article <2FE620E1-623B-425B...@microsoft.com>,
MSI...@discussions.microsoft.com says...
--
Kim Oppalfens
SMS MVP