Skip to content

Commit

Permalink
Updated scripts from Matthew Teegarden
Browse files Browse the repository at this point in the history
  • Loading branch information
arwidmark committed Mar 25, 2017
1 parent 9fa1d3a commit 8ab8075
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Scripts/Get-DriverPackage.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Name: Get-DriverPacakge
# Name: Get-DriverPackage
# Description: Gets the driver package ID for download during a Task Sequence
# Author: Matthew Teegarden

Expand Down
125 changes: 125 additions & 0 deletions Scripts/PowerShell-Template.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Name: PowerShell Template
# Description: Standard PowerShell template
# Author:

try
{
Function Main
{
# Function Started
LogTraceMessage "*** Function Main Started ***"
Write-Verbose "*** Function Main Started ***"

# Set Global Environment Variables (Inputs)
SetGlobalEnvVariables

# Import PS Modules
ImportPsModules

# Create and add more funcitons

# Function Finished
LogTraceMessage "*** Function Main Finished ***"
Write-Verbose "*** Function Main Finished ***"
}

Function SetGlobalEnvVariables
{
# Function Started
LogTraceMessage "*** Function SetGlobalEnvVariables Started ***"
Write-Verbose "*** Function SetGlobalEnvVariables Started ***"

# Base script variables. No modification should be necessary

# Set variables with global scope
$script:TraceState = ''
LogTraceMessage "Variable TraceState set to $script:TraceState"
Write-Verbose "Variable TraceState set to $script:TraceState"

$script:ErrorMessage = ''
LogTraceMessage "Variable ErrorMessage set to $script:ErrorMessage"
Write-Verbose "Variable ErrorMessage set to $script:ErrorMessage"

$script:ErrorState = 0
LogTraceMessage "Variable ErrorState set to $script:ErrorState"
Write-Verbose "Variable ErrorState set to $script:ErrorState"

#Script variables. Modify as necessary

$Script:LoggingPath = 'c:\Windows\Temp\Set-DriverPackageXML.log'
LogTraceMessage "Variable LoggingPath set to $script:LoggingPath"
Write-Verbose "Variable LoggingPath set to $script:LoggingPath"

# Add variables here

# Function Finished
LogTraceMessage "*** Function SetGlobalEnvVariables Finished ***"
Write-Verbose "*** Function SetGlobalEnvVariables Finished ***"
}

Function ImportPsModules
{
# Function Started
LogTraceMessage "*** Function ImportPsModules Started ***"
Write-Verbose "*** Function ImportPsModules Started ***"

# Function Finished
LogTraceMessage "*** Function ImportPsModules Finished ***"
Write-Verbose "*** Function ImportPsModules Finished ***"
}

Function LogTraceMessage ($strMessage)
{
[array]$script:TraceMessage += (Get-Date).ToString() + ': ' + $strMessage + '~~'
}

# Script Started
LogTraceMessage "*** Set Driver Pacakge XML ***"
Write-Verbose "*** Set Driver Pacakge XML ***"

#Main
Main

}

Catch
{
# Catch Started
LogTraceMessage "*** Catch Started ***"
Write-Verbose "*** Catch Started ***"

# Log error messages
$script:ErrorMessage = $Error[0].Exception.ToString()
LogTraceMessage "Variable ErrorMessage set to $script:ErrorMessage"
Write-Verbose "Variable ErrorMessage set to $script:ErrorMessage"

$script:ErrorState = 3
LogTraceMessage "Variable ErrorState set to $script:ErrorState"
Write-Verbose "Variable ErrorState set to $script:ErrorState"

# Catch Finished
LogTraceMessage "*** Catch Finished ***"
Write-Verbose "*** Catch Finished ***"
}

Finally
{
# Finally Started
LogTraceMessage "*** Finally Started ***"
Write-Verbose "*** Finally Started ***"

# Log Error State/Message
LogTraceMessage "Variable ErrorState = $script:ErrorState"
Write-Verbose "Variable ErrorState = $script:ErrorState"

# Finally Finished
LogTraceMessage "*** Finally Finished ***"
Write-Verbose "*** Finally Finished ***"
# Script Finished
LogTraceMessage "*** Name of script Finished ***"
Write-Verbose "*** name of script finished Finished ***"

# Write to log file
$script:TraceMessage | Out-File $script:LoggingPath

}
2 changes: 1 addition & 1 deletion Scripts/Set-DriverPackageXML.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Name: Set-DriverPackageXML
# Description: updates the DriverPacakge XML file whenever a package status chamges according to Satatus Filter Rule Set-DriverPackageXML
# Description: updates the DriverPacakge XML file whenever a package status changes according to Satatus Filter Rule Set-DriverPackageXML
# Author: Matthew Teegarden

try
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Set-WMIEventingForSet-DriverPackageXML.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Name: Get-DriverPacakge
# Name: Get-DriverPackage
# Description: Gets the driver package ID for download during a Task Sequence
# Author: Matthew Teegarden

Expand Down

0 comments on commit 8ab8075

Please sign in to comment.