Skip to content

Commit

Permalink
Folder rename
Browse files Browse the repository at this point in the history
  • Loading branch information
DeploymentBunny committed Nov 21, 2016
1 parent c1b525a commit a96d851
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 261 deletions.
97 changes: 0 additions & 97 deletions Tools/Configure - HP ILO/Configure-HP_ILO.ps1

This file was deleted.

File renamed without changes.
File renamed without changes.
195 changes: 31 additions & 164 deletions Tools/Install-Wrapper/Invoke-Install.ps1
Original file line number Diff line number Diff line change
@@ -1,170 +1,25 @@
Function Get-OSVersion([ref]$OSv){
$OS = Get-WmiObject -Class Win32_OperatingSystem
Switch -Regex ($OS.Version)
{
"6.1"
{If($OS.ProductType -eq 1)
{$OSv.value = "Windows 7 SP1"}
Else
{$OSv.value = "Windows Server 2008 R2"}
}
"6.2"
{If($OS.ProductType -eq 1)
{$OSv.value = "Windows 8"}
Else
{$OSv.value = "Windows Server 2012"}
}
"6.3"
{If($OS.ProductType -eq 1)
{$OSv.value = "Windows 8.1"}
Else
{$OSv.value = "Windows Server 2012 R2"}
}
"10"
{If($OS.ProductType -eq 1)
{$OSv.value = "Windows 10"}
Else
{$OSv.value = "Windows Server 2016"}
}
DEFAULT { "Version not listed" }
}
}
Function Import-SMSTSENV{
try
{
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
Write-Output "$ScriptName - tsenv is $tsenv "
$MDTIntegration = "YES"

#$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
}
catch
{
Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
Write-Output "$ScriptName - Running in standalonemode"
$MDTIntegration = "NO"
}
Finally
{
if ($MDTIntegration -eq "YES"){
$Logpath = $tsenv.Value("LogPath")
$LogFile = $Logpath + "\" + "$ScriptName.txt"

}
Else{
$Logpath = $env:TEMP
$LogFile = $Logpath + "\" + "$ScriptName.txt"
}
}
}
Function Start-Logging{
start-transcript -path $LogFile -Force
}
Function Stop-Logging{
Stop-Transcript
}
Function Invoke-Exe{
[CmdletBinding(SupportsShouldProcess=$true)]

param(
[parameter(mandatory=$true,position=0)]
[ValidateNotNullOrEmpty()]
[string]
$Executable,

[parameter(mandatory=$false,position=1)]
[string]
$Arguments
)
<#
Generic installer Wrapper
#>

if($Arguments -eq "")
{
Write-Verbose "Running Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
$ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
}else{
Write-Verbose "Running Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
$ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
}
Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
Return $ReturnFromEXE.ExitCode
}
Function Invoke-Msi{
[CmdletBinding(SupportsShouldProcess=$true)]

param(
[parameter(mandatory=$true,position=0)]
[ValidateNotNullOrEmpty()]
[string]
$MSI,

[parameter(mandatory=$false,position=1)]
[string]
$Arguments
)

#Set MSIArgs
$MSIArgs = "/i " + $MSI + " " + $Arguments

if($Arguments -eq "")
{
$MSIArgs = "/i " + $MSI


}
else
{
$MSIArgs = "/i " + $MSI + " " + $Arguments

}
Write-Verbose "Running Start-Process -FilePath msiexec.exe -ArgumentList $MSIArgs -NoNewWindow -Wait -Passthru"
$ReturnFromEXE = Start-Process -FilePath msiexec.exe -ArgumentList $MSIArgs -NoNewWindow -Wait -Passthru
Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
Return $ReturnFromEXE.ExitCode
}
Function Invoke-Msu{
[CmdletBinding(SupportsShouldProcess=$true)]
[cmdletbinding(SupportsShouldProcess=$True)]
Param
(
$Role="None"
)

param(
[parameter(mandatory=$true,position=0)]
[ValidateNotNullOrEmpty()]
[string]
$MSU,

[parameter(mandatory=$false,position=1)]
[string]
$Arguments
)

#Set MSIArgs
$MSUArgs = $MSU + " " + $Arguments

if($Arguments -eq "")
{
$MSUArgs = $MSU


}
else
{
$MSUArgs = $MSU + " " + $Arguments

}

Write-Verbose "Running Start-Process -FilePath wusa.exe -ArgumentList $MSUArgs -NoNewWindow -Wait -Passthru"
$ReturnFromEXE = Start-Process -FilePath wusa.exe -ArgumentList $MSUArgs -NoNewWindow -Wait -Passthru
Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
Return $ReturnFromEXE.ExitCode
}
# Set Vars
$ScriptDir = split-path -parent $MyInvocation.MyCommand.Path
$ScriptName = split-path -leaf $MyInvocation.MyCommand.Path
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ScriptName = Split-Path -Leaf $MyInvocation.MyCommand.Path
#[xml]$Settings = Get-Content "$ScriptDir\Settings.xml"

$SOURCEROOT = "$SCRIPTDIR\Source"
$LANG = (Get-Culture).Name
$OSV = $Null
$ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE

#Import function library
Import-Module "$ScriptDir\VIAInstall.psm1" -ErrorAction Stop -WarningAction Stop

#Try to Import SMSTSEnv
. Import-SMSTSENV

Expand All @@ -185,12 +40,24 @@ Write-Output "$ScriptName - Current Culture: $LANG"
Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
Write-Output "$ScriptName - Log: $LogFile"

#Determine what to do

switch ($osv)
{
'Windows Server 2012 R2'{Invoke-Msu -MSU """$ScriptDir\Source\Win8.1AndW2K12R2-KB3134758-x64.msu""" -Arguments "/quiet /norestart" -Verbose}
Default {}
#Generate more info
if($MDTIntegration -eq "YES"){
$TSMake = $tsenv.Value("Make")
$TSModel = $tsenv.Value("Model")
$TSMakeAlias = $tsenv.Value("MakeAlias")
$TSModelAlias = $tsenv.Value("ModelAlias")
$TSOSDComputerName = $tsenv.Value("OSDComputerName")
Write-Output "$ScriptName - Make:: $TSMake"
Write-Output "$ScriptName - Model: $TSModel"
Write-Output "$ScriptName - MakeAlias: $TSMakeAlias"
Write-Output "$ScriptName - ModelAlias: $TSModelAlias"
Write-Output "$ScriptName - OSDComputername: $TSOSDComputerName"
}

#Custom Code Starts--------------------------------------



#Custom Code Ends--------------------------------------

. Stop-Logging
Loading

0 comments on commit a96d851

Please sign in to comment.