Skip to content

Commit

Permalink
Added ManagementGroupName to discovery scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
gummigroda committed Feb 14, 2020
1 parent 4022abf commit e6ee314
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

*.[Ss][Nn][Kk]
*.[Mm][Pp]
*.[Mm][Pp][Bb]

# User-specific files
*.suo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<Name>computerName</Name>
<Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>MGMTName</Name>
<Value>$Target/ManagementGroup/Name$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<Name>computerName</Name>
<Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>MGMTName</Name>
<Value>$Target/ManagementGroup/Name$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
<Name>computerName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>MGMTName</Name>
<Value>$Target/ManagementGroup/Name$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>600</TimeoutSeconds>
</DataSource>
Expand Down Expand Up @@ -179,6 +183,10 @@
<Name>computerName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>MGMTName</Name>
<Value>$Target/ManagementGroup/Name$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>600</TimeoutSeconds>
</DataSource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
<Name>computerName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>MGMTName</Name>
<Value>$Target/ManagementGroup/Name$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>600</TimeoutSeconds>
</DataSource>
Expand Down
2 changes: 1 addition & 1 deletion LOST.Windows.Extended.Lib/LOST.Windows.Extended.Lib.mpproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<RootNamespace>LOST.Windows.Extended</RootNamespace>
<Name>LOST Windows Extended Library</Name>
<ManagementPackName>LOST.Windows.Extended.Lib</ManagementPackName>
<Version>1.0.2.0</Version>
<Version>1.0.2.1</Version>
<MpFrameworkVersion>v7.0.2</MpFrameworkVersion>
<MpFrameworkProfile>OM</MpFrameworkProfile>
<ProductVersion>1.1.0.0</ProductVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
param($sourceId,$managedEntityId,$computerName)
param($sourceId,$managedEntityId,$computerName,$MGMTName)

function Write-Log([string]$Message) {
$printDate = (get-date -F s)
$printDate = (get-date).ToString("yyyy-MM-dd HH:mm:ss.fff")
$script:traceLog += ("{0} | {1}" -f $printDate, $Message)
Write-Output ("{0} | {1}" -f $printDate, $Message)
}

try {
# Set stuff
[string]$scriptName = $MyInvocation.MyCommand.Name
[string]$scriptVersion = 'v1.01'
[string]$scriptName = (Split-Path -Path $PSCommandPath -Leaf)
[string]$scriptVersion = 'v1.02'
[int]$evtID = 1337
[string[]]$script:traceLog = @()
# type, 1=Error, 2=Warning, 4=Information
Expand All @@ -22,7 +23,7 @@ try {
[string]$SMBIOSTAG = ''
[string]$serialNumber = ''

Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}]" -f $scriptVersion, (whoami))
Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}], ManagementGroup: [{2}]" -f $scriptVersion, (whoami), $MGMTName)
Write-Log -Message ("Start discovery of SystemInfo with SourceID: [{0}] ManagedID: [{1}] Computername: [{2}]" -f $sourceId, $ManagedEntityId, $computerName)

# Create MOM Script API and Discoverydata
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
param($sourceId,$managedEntityId,$computerName)
param($sourceId,$managedEntityId,$computerName,$MGMTName)

try {
function Write-Log([string]$Message) {
$printDate = (get-date -F s)
$script:traceLog += ("{0} | {1}" -f $printDate, $Message)
Write-Output ("{0} | {1}" -f $printDate, $Message)
}
function Write-Log([string]$Message) {
$printDate = (get-date).ToString("yyyy-MM-dd HH:mm:ss.fff")
$script:traceLog += ("{0} | {1}" -f $printDate, $Message)
Write-Output ("{0} | {1}" -f $printDate, $Message)
}

try {
# Set stuff
[string]$scriptName = $MyInvocation.MyCommand.Name
[string]$scriptVersion = 'v1.01'
[string]$scriptVersion = 'v1.02'
[int]$evtID = 1337
$script:traceLog = @()
[int]$EventType = 4 # type, 1=Error, 2=Warning, 4=Information

# Pretty hash...
$LicReason = [ordered]@{0='Unlicensed';1='Licensed';2='OOB Grace';3='OOT Grace';4='Non-Genuine Grace';5='Notification';6='Extended Grace'}

Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}]" -f $scriptVersion, (whoami))
Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}], ManagementGroup: [{2}]" -f $scriptVersion, (whoami), $MGMTName)
Write-Log -Message ("Start discovery of 'Windows LicenseStatus' with SourceID: [{0}] ManagedID: [{1}] Computername: [{2}]" -f $sourceId, $ManagedEntityId, $computerName)

# Create MOM Script API and Discoverydata
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
param($sourceId,$managedEntityId,$computerName)
param($sourceId,$managedEntityId,$computerName,$MGMTName)

function Write-Log([string]$Message) {
$printDate = (get-date).ToString("yyyy-MM-dd HH:mm:ss.fff")
$script:traceLog += ("{0} | {1}" -f $printDate, $Message)
Write-Output ("{0} | {1}" -f $printDate, $Message)
}

try {
function Write-Log([string]$Message) {
$printDate = (get-date -F s)
$script:traceLog += ("{0} | {1}" -f $printDate, $Message)
Write-Output ("{0} | {1}" -f $printDate, $Message)
}

# Set stuff
[string]$scriptName = $MyInvocation.MyCommand.Name
[string]$scriptVersion = 'v1.03'
[string]$scriptVersion = 'v1.04'
[int]$evtID = 1337
$script:traceLog = @()
[int]$EventType = 4 # type, 1=Error, 2=Warning, 4=Information
Expand All @@ -18,7 +18,7 @@ try {
$AuOpts = @{1 = 'Automatic Updates DISABLED';2 = 'Notify of download and installation';3 = 'Download and notify';4 = 'Download and schedule'}
$AUDays = @{0='Every Day';1='Sunday';2='Monday';3='Tuesday';4='Wednesday';5='Thursday';6='Friday';7='Saturday'}

Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}]" -f $scriptVersion, (whoami))
Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}], ManagementGroup: [{2}]" -f $scriptVersion, (whoami), $MGMTName)
Write-Log -Message ("Start discovery of 'Windows WSUS Settings' with SourceID: [{0}] ManagedID: [{1}] Computername: [{2}]" -f $sourceId, $ManagedEntityId, $computerName)

# Create MOM Script API and Discoverydata
Expand Down
18 changes: 9 additions & 9 deletions LOST.Windows.Extended.Lib/Scripts/LOST.Win.OS.Discovery.WU.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
param($sourceId,$managedEntityId,$computerName)
param($sourceId,$managedEntityId,$computerName,$MGMTName)

function Write-Log([string]$Message) {
$printDate = (get-date).ToString("yyyy-MM-dd HH:mm:ss.fff")
$script:traceLog += ("{0} | {1}" -f $printDate, $Message)
Write-Output ("{0} | {1}" -f $printDate, $Message)
}

try {
function Write-Log([string]$Message) {
$printDate = (get-date -F s)
$script:traceLog += ("{0} | {1}" -f $printDate, $Message)
Write-Output ("{0} | {1}" -f $printDate, $Message)
}

# Set stuff
[string]$scriptName = $MyInvocation.MyCommand.Name
[string]$scriptVersion = 'v1.05'
[string]$scriptVersion = 'v1.06'
[int]$evtID = 1337
$script:traceLog = @()
[int]$EventType = 4 # type, 1=Error, 2=Warning, 4=Information
Expand All @@ -19,7 +19,7 @@ try {
[int]$importantUpdates = 0
[int]$otherUpdates = 0

Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}]" -f $scriptVersion, (whoami))
Write-Log -Message ("ScriptVersion: [{0}], Running as: [{1}], ManagementGroup: [{2}]" -f $scriptVersion, (whoami), $MGMTName)
Write-Log -Message ("Start discovery of 'Windows Updates' with SourceID: [{0}] ManagedID: [{1}] Computername: [{2}]" -f $sourceId, $ManagedEntityId, $computerName)

# Create MOM Script API and Discoverydata
Expand Down

0 comments on commit e6ee314

Please sign in to comment.