Trevor nailed it. I actually am in the middle of writing a script for ConfigMgr 2007 that will add a new program to a package. Everything works except the OS choices. I am actually just creating a new program for Nomad TS Hook that mirrors the existing install program.
import-module .\sccm_2007.psm1
$server = "YOUR SERVER"
$site = "YOUR SITE CODE"
$prgflags = 1090560
write-host ""
write-host "Querying the site server for packages and programs..."
-foregroundcolor yellow
connect-sccmserver -server $server -site $site
$packages = Get-WmiObject SMS_Package -computername $server -Namespace
root\SMS\site_$site
$programs = Get-WmiObject SMS_Program -computername $server -Namespace
root\SMS\site_$site
write-host ""
write-host "1" -foregroundcolor cyan -nonewline;write-host " - List all
Packages"
write-host "2" -foregroundcolor cyan -nonewline;write-host " - Add Nomad TS
Hook to a package"
write-host ""
write-host "Enter your choice: " -foregroundcolor cyan -nonewline;
$choice = read-host
write-host ""
switch ($choice) {
1 {
$packages| select manufacturer, name, version, packageid | sort
manufacturer
}
2 {
write-host "Enter your Package ID to modify: " -foregroundcolor cyan
-nonewline;
$pkgid = Read-host
$pkgmfg = ($packages | where {$_.packageid -eq $pkgid}).Manufacturer
$pkgname = ($packages | where {$_.packageid -eq $pkgid}).Name
$pkgversion = ($packages | where {$_.packageid -eq $pkgid}).Version
write-host "You chose: " -foregroundcolor cyan -nonewline; write-host
$pkgid
write-host "Package Title: " -foregroundcolor cyan
-nonewline;write-host $pkgmfg" "$pkgname" "$pkgversion
write-host "Existing programs: " -foregroundcolor cyan
$programs | where {$_.packageid -eq $pkgid} | select
ProgramName,CommandLine
$cmdline = ($programs | where {$_.packageid -eq $pkgid -and
$_.programname -eq "HUMINST"}).commandline
$arguments = @{
PackageID = $pkgID;
ProgramFlags = $prgflags;
ProgramName = "Nomad TS Hook";
CommandLine = "%ProgramFiles%\1E\NomadBranch\SMSNomad.exe " +
$cmdline;
Duration = 120
}
write-host ""
write-host "Adding Nomad TS Hook program to package"$pkgid
-foregroundcolor green
Set-wmiinstance SMS_Program -arguments $arguments -computername $server
-namespace root\SMS\site_$site
$programs = Get-WmiObject SMS_Program -computername $server -Namespace
root\SMS\site_$site
write-host ""
write-host "Existing programs:" -foregroundcolor cyan
$programs | where {$_.packageid -eq $pkgid} | select
ProgramName,CommandLine
}
3 {
}
4 {
}
5 {
}
default {
write-host "Invalid Choice. Exiting. " -foregroundcolor red
start-sleep -seconds 5
exit
}
}
Daniel Ratliff
From: [email protected] [mailto:[email protected]] On
Behalf Of Trevor Sullivan
Sent: Wednesday, May 15, 2013 3:41 PM
To: [email protected]
Subject: RE: [mssms] SMS File information for CM2007
Henry,
Those settings are stored in the SMS_Program WMI class' ProgramFlags property,
if I recall correctly. It should be pretty easy to script out those changes to
Program objects. The specific bits to change are documented in the ConfigMgr
2007 SDK. Let me know if you need help doing this.
Cheers,
Trevor Sullivan
[WordPress Logo 32px]<http://trevorsullivan.net/> [Twitter Logo 32px]
<http://twitter.com/pcgeek86> [Facebook Logo 32px]
<http://facebook.com/trevor.sullivan> [Google+ Icon 32px]
<https://plus.google.com/106658223083457664096>
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
On Behalf Of [email protected]<mailto:[email protected]>
Sent: Wednesday, May 15, 2013 2:31 PM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] SMS File information for CM2007
Working in CM2007 our packagers are asking if there are commands that can be
added to the SMS file to enable/toggle the highlighted options?
[cid:[email protected]]
I found a script that will change all packages but that would not be a good
idea. Also, the SMS file is created before the package ID is generated (saw
another script for that too). This becomes a real PITA when you have to check
these after the package is created.
Any help would be appreciated.
Thanks
The information transmitted is intended only for the person or entity to which
it is addressed
and may contain CONFIDENTIAL material. If you receive this
material/information in error,
please contact the sender and delete or destroy the material/information.
<<inline: image001.gif>>
<<inline: image002.gif>>
<<inline: image003.gif>>
<<inline: image004.gif>>
<<inline: image005.jpg>>

