Initial Commit
This commit is contained in:
parent
1941a2f386
commit
f201c3a8aa
3
Args-Test.ps1
Normal file
3
Args-Test.ps1
Normal file
@ -0,0 +1,3 @@
|
||||
$Arg1 = $args[0]
|
||||
$Arg2 = $args[1]
|
||||
Write-Host "$Arg1 and $Arg2"
|
28
Computer-NameScheme.ps1
Normal file
28
Computer-NameScheme.ps1
Normal file
@ -0,0 +1,28 @@
|
||||
# Script to change computer name matching new naming scheme as of 2024-06.
|
||||
# Technolog Networks - 2024-07-26
|
||||
# iRaven
|
||||
|
||||
Start-Transcript -Path "c:\irnh\Computer-NameScheme.log" -Append
|
||||
|
||||
# General necessities.
|
||||
$CompName = $env:COMPUTERNAME
|
||||
$ADCompOU = ([adsisearcher]"(&(objectClass=computer)(sAMAccountName=$CompName$))").FindOne().GetDirectoryEntry().distinguishedName
|
||||
$PCNamePrefix = ($CompName.Substring(0,$CompName.IndexOf("-")))
|
||||
$PCNameSuffix = ($CompName.Substring($CompName.IndexOf("-")+1))
|
||||
# Domain Credentials to be used
|
||||
. "\\berrypunch.technolog.net\PSCredentials$\Credentials-WKSDeploy.ps1"
|
||||
|
||||
Function RenamePCTNGPrefix {
|
||||
Write-Host "Renaming this computer to TNG-$PCNameSuffix."
|
||||
Rename-Computer -NewName "TNG-$PCNameSuffix" -DomainCredential $DomainCredential -Restart
|
||||
}
|
||||
|
||||
if ($PCNamePrefix -like "NH" -or $PCNamePrefix -like "IR") {
|
||||
RenamePCTNGPrefix
|
||||
} elseif ($ADCompOU -like "*Personal*" -Or ($PCNamePrefix -like "XH")) {
|
||||
Write-Host "This is an XH system, we shall not change anything."
|
||||
} else {
|
||||
echo "Computer name is valid; not making changes."
|
||||
}
|
||||
|
||||
Stop-Transcript
|
25
GetADOU.ps1
Normal file
25
GetADOU.ps1
Normal file
@ -0,0 +1,25 @@
|
||||
# Script to get current OU.
|
||||
# Technolog Networks, 04/30/2024
|
||||
|
||||
# Define our AD searcher
|
||||
$adsearcher = New-Object System.DirectoryServices.DirectorySearcher
|
||||
|
||||
# Filter to return only computer objs
|
||||
$adsearcher.Filter = "(&(objectClass=computer)(samAccountName=$env:computername$))"
|
||||
|
||||
# Find the object in the directory
|
||||
$adobjpath = $adsearcher.FindOne()
|
||||
|
||||
# Return the LDAP path for the object
|
||||
$adobject = $adobjpath.GetDirectoryEntry()
|
||||
|
||||
# Stupid: get the OU of the computer by returning the parent object
|
||||
$computerou = $adobject.Parent
|
||||
|
||||
if ($computerou.Contains("OU=PersonalComputers")){
|
||||
echo "This is an XH system ($computerou)"
|
||||
} elseif ($computerou.Contains("OU=Workstations")) {
|
||||
echo "This is WKS ($computerou)"
|
||||
} elseif ($computerou.Contains("OU=Domain Servers")) {
|
||||
echo "This is a server ($computerou)"
|
||||
}
|
70
Install-MSOffice.ps1
Normal file
70
Install-MSOffice.ps1
Normal file
@ -0,0 +1,70 @@
|
||||
# Script to install Microsoft Office versions 2016-2024.
|
||||
# Technolog Networks - 2024-09-16
|
||||
# iRaven
|
||||
|
||||
Start-Transcript -Path "c:\irnh\Install-MSOffice.log" -Append
|
||||
|
||||
$SoftwareDeployLocation = "\\minuette2.technolog.net\SoftwareLibrary\Software\MSOffice"
|
||||
$ParamVersion = $args[0]
|
||||
|
||||
# Office Install Checks
|
||||
echo "Checking currently installed Office version (if applicable)..."
|
||||
$OfficeVersionInstalled = (Get-WmiObject -Class Win32_Product | where name -like "Microsoft Office*" | select Name, Version).Version
|
||||
$Office2016 = (Get-WmiObject -Class Win32_Product | where name -like "Microsoft Office*2016" | select Name, Version)
|
||||
$Office2019 = (Get-WmiObject -Class Win32_Product | where name -like "Microsoft Office*2019" | select Name, Version)
|
||||
$Office2021 = (Get-WmiObject -Class Win32_Product | where name -like "Microsoft Office*2021" | select Name, Version)
|
||||
$Office2024 = (Get-WmiObject -Class Win32_Product | where name -like "Microsoft Office*2024" | select Name, Version)
|
||||
|
||||
Function CheckInstall {
|
||||
if ($null -ne $OfficeVersionInstalled) {
|
||||
if ($OfficeVersionInstalled -ge "16.0" ) { # Checks if currently installed Office is less than version 16 (2016)
|
||||
if ($null -eq $Office2016 -and $ParamVersion -eq 2016) {
|
||||
Write-Host "Office $ParamVersion is already installed. No action will be taken."
|
||||
return $true
|
||||
} elseif ($null -ne $Office2019 -and $ParamVersion -eq 2019) {
|
||||
Write-Host "Office $ParamVersion is already installed. No action will be taken."
|
||||
return $true
|
||||
} elseif ($null -ne $Office2021 -and $ParamVersion -eq 2021) {
|
||||
Write-Host "Office $ParamVersion is already installed. No action will be taken."
|
||||
return $true
|
||||
} elseif ($null -ne $Office2024 -and $ParamVersion -eq 2024) {
|
||||
Write-Host "Office $ParamVersion is already installed. No action will be taken."
|
||||
return $true
|
||||
} else {
|
||||
Write-Host "The office version currently installed is different from specified ($ParamVersion). Upgrading to $ParamVersion."
|
||||
return $false
|
||||
}
|
||||
} else {
|
||||
Write-Host "An older version of Office is already installed. Upgrading to $ParamVersion."
|
||||
return $true
|
||||
}
|
||||
} else {
|
||||
Write-Host "Office is not installed at all."
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
if ((CheckInstall) -eq $false) {
|
||||
cd $SoftwareDeployLocation
|
||||
if ($ParamVersion -eq 2016){
|
||||
try {
|
||||
.\OfficeProPlus2016_VL\setup.exe /adminfile TNGOffice16Deploy.msp
|
||||
} catch {
|
||||
Write-Host "Office $ParamVersion could not be installed."
|
||||
}
|
||||
} elseif ($ParamVersion -eq 2021) {
|
||||
try {
|
||||
.\setup.exe /configure office2021_deploy.xml
|
||||
} catch {
|
||||
Write-Host "Office $ParamVersion could not be installed."
|
||||
}
|
||||
} elseif ($ParamVersion -eq 2024) {
|
||||
try {
|
||||
.\setup.exe /configure office2024_deploy.xml
|
||||
} catch {
|
||||
Write-Host "Office $ParamVersion could not be installed."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Stop-Transcript
|
35
Install-MeshCentral-Agent.ps1
Normal file
35
Install-MeshCentral-Agent.ps1
Normal file
@ -0,0 +1,35 @@
|
||||
# Script to install MeshCentral Agent.
|
||||
# Technolog Networks - 2024-08-20
|
||||
# iRaven
|
||||
|
||||
Start-Transcript -Path "c:\irnh\Install-MeshCentral-Agent.log" -Append
|
||||
|
||||
$ADCompOU = ([adsisearcher]"(&(objectClass=computer)(sAMAccountName=$env:computername$))").FindOne().GetDirectoryEntry().distinguishedName
|
||||
|
||||
Function CheckInstall {
|
||||
if (test-path -path "c:\Program Files\Mesh Agent") {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
if ((CheckInstall) -eq $false) {
|
||||
if ($ADCompOU -like "*Headend*") { # We put this at the top due to our OU structure. (e.g. OU=Headend, OU=Domain Servers/OU=Workstations)
|
||||
Write-Host "Installing Headend Mesh Agent..."
|
||||
\\technolog.net\netlogon\TNGMeshInstaller\meshagent64-Headend.exe -fullinstall
|
||||
}
|
||||
elseif ($ADCompOU -like "*Workstations*") {
|
||||
Write-Host "Installing WKS Mesh Agent..."
|
||||
\\technolog.net\netlogon\TNGMeshInstaller\meshagent64-NH-WKS.exe -fullinstall
|
||||
}
|
||||
elseif ($ADCompOU -like "*Domain Servers*") {
|
||||
Write-Host "Installing Servers Mesh Agent..."
|
||||
\\technolog.net\netlogon\TNGMeshInstaller\meshagent64-NH-Servers.exe -fullinstall
|
||||
}
|
||||
else {
|
||||
Write-Error -Message "No OU was defined or computer is not joined to domain."
|
||||
}
|
||||
}
|
||||
|
||||
Stop-Transcript
|
34
Install-Office-2016.ps1
Normal file
34
Install-Office-2016.ps1
Normal file
@ -0,0 +1,34 @@
|
||||
# Script to install Office ProPlus 2016 VL.
|
||||
# Technolog Networks - 2024-08-21
|
||||
# iRaven
|
||||
|
||||
Start-Transcript -Path "c:\irnh\Install-Office-2016.log" -Append
|
||||
|
||||
$OfficeVersionInstalled = (Get-WmiObject -Class Win32_Product | where name -like "Zabbix*" | select Name, Version).Version
|
||||
$SoftwareDeployLocation = "\\minuette2.technolog.net\SoftwareLibrary\Software\MSOffice\OfficeProPlus2016_VL"
|
||||
|
||||
Function CheckInstall {
|
||||
if ($OfficeVersionInstalled -ne $null) {
|
||||
if ($OfficeVersionInstalled -lt "16.0" ) { # Checks if currently installed Office is less than version 16 (2016)
|
||||
Write-Host "An older version of Office is already installed. Upgrading to 2016."
|
||||
return $false
|
||||
} else {
|
||||
Write-Host "Office 2016 is already installed."
|
||||
return $true
|
||||
}
|
||||
} else {
|
||||
Write-Host "Office is not installed at all."
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
if ((CheckInstall) -eq $false) {
|
||||
cd $SoftwareDeployLocation
|
||||
try {
|
||||
.\setup.exe /adminfile TNGOffice16Deploy.msp
|
||||
} catch {
|
||||
Write-Host "Office 2016 could not be installed."
|
||||
}
|
||||
}
|
||||
|
||||
Stop-Transcript
|
82
Install-WinGet.ps1
Normal file
82
Install-WinGet.ps1
Normal file
@ -0,0 +1,82 @@
|
||||
# Script to install winget.
|
||||
# Technolog Networks, 2024-07-26
|
||||
# iRaven
|
||||
|
||||
# Updated 2025-04-03 to get the legitimate install method MS recommends to use here.
|
||||
# https://learn.microsoft.com/en-us/windows/iot/iot-enterprise/deployment/install-winget-windows-iot
|
||||
|
||||
Start-Transcript -Path "c:\irnh\Install-WinGet.log" -Append
|
||||
|
||||
# See if the shit we need exists.
|
||||
Function Check-WinGet-Install {
|
||||
try {
|
||||
winget --version
|
||||
Write-Host "WinGet already exists!"
|
||||
return $true
|
||||
}
|
||||
catch {
|
||||
Write-Host "WinGet does not exist!"
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
Function Check-VCLibs {
|
||||
if ((Get-AppxPackage).Name -like "Microsoft.VCLibs.140.00.UWPDesktop" ) {return $true} else {return $false}
|
||||
}
|
||||
|
||||
Function Install-VCLibs {
|
||||
if (Check-VCLibs) {
|
||||
Write-Output "VCLibs.UWPDesktop is already installed."
|
||||
} else {
|
||||
cmd.exe /c "curl -L -o c:\irnh\vclibs.14.00.Desktop.appx https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
|
||||
try {
|
||||
Add-AppxPackage -Path "c:\irnh\vclibs.14.00.Desktop.appx"
|
||||
# Add-AppxProvisionedPackage -Online -PackagePath "c:\irnh\vclibs.14.00.Desktop.appx" -SkipLicense
|
||||
Write-Output "VCLibs.UWPDesktop was installed."
|
||||
} catch {
|
||||
Write-Output "VCLibs.UWPDesktop could not be installed."
|
||||
}
|
||||
}
|
||||
}
|
||||
Function Install-WinGet {
|
||||
Write-Host "Checking latest version..."
|
||||
$WGLatestVer = (irm https://api.github.com/repos/microsoft/winget-cli/releases/latest).tag_name
|
||||
$WGDomainVer = type "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlatestver.txt"
|
||||
if ($WGDomainVer -eq $WGLatestVer) {
|
||||
# If the version we have on our domain controllers is the latest, proceed with the offline copy.
|
||||
Write-Output "Domain Controllers has the latest version $WGDomainVer; using that."
|
||||
try {
|
||||
Add-AppxPackage -Path "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\winget.msixbundle"
|
||||
Add-AppxProvisionedPackage -Online -PackagePath "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\winget.msixbundle" -LicensePath "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlic.xml"
|
||||
Write-Output "WinGet was successfully installed."
|
||||
} catch {
|
||||
Write-Output "WinGet could not be installed."
|
||||
}
|
||||
}
|
||||
else {
|
||||
# If the version we have on our domain controllers is NOT the latest, we have to get it online.
|
||||
Write-Host "Internet has the latest copy; downloading WinGet from Microsoft."
|
||||
cmd.exe /c "curl -L -o c:\irnh\winget.msixbundle https://aka.ms/getwinget" # I hate IWR. lol
|
||||
# download latest lic file
|
||||
foreach ($url in (irm https://api.github.com/repos/microsoft/winget-cli/releases/latest).assets.browser_download_url){
|
||||
if ($url -like "*.xml")
|
||||
{cmd.exe /c "curl -L -o c:\irnh\wingetlic.xml $url"} # I hate IWR. lol
|
||||
}
|
||||
try {
|
||||
# Add-AppxPackage -Path "c:\irnh\winget.msixbundle"
|
||||
Add-AppxPackage -Path "c:\irnh\winget.msixbundle"
|
||||
Add-AppxProvisionedPackage -Online -PackagePath "c:\irnh\winget.msixbundle" -LicensePath "c:\irnh\wingetlic.xml"
|
||||
Write-Output "WinGet was successfully installed."
|
||||
} catch {
|
||||
Write-Output "WinGet could not be installed."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Main script
|
||||
|
||||
if (!(Check-WinGet-Install)) {
|
||||
Install-VCLibs
|
||||
Install-WinGet
|
||||
}
|
||||
Stop-Transcript
|
42
Install-ZabbixAgent.ps1
Normal file
42
Install-ZabbixAgent.ps1
Normal file
@ -0,0 +1,42 @@
|
||||
# Script to install zabbix agent.
|
||||
# Technolog Networks, 2024-07-27
|
||||
# iRaven
|
||||
|
||||
Start-Transcript -Path "c:\irnh\Install-ZabbixAgent.log" -Append
|
||||
|
||||
$InstallFolder = "C:\Program Files\Zabbix Agent"
|
||||
$InstallerLog = "C:\irnh\Installer-ZabbixAgent.log"
|
||||
$SoftwareDeployLocation = "\\technolog.net\sysvol\technolog.net\SoftwareDeploy\zabbix_agent-7.0.9-windows-amd64-openssl.msi"
|
||||
$SDZabbixVersion = "7.0.9"
|
||||
$ZabbixVersionInstalled = (Get-WmiObject -Class Win32_Product | where name -like "Zabbix*" | select Name, Version).Version
|
||||
|
||||
# Zabbix settings
|
||||
$ZabbixServer = "10.10.0.90"
|
||||
$ZabbixAgentLogFile = "$InstallFolder\zabbix_agentd.log"
|
||||
|
||||
Function CheckZabbixInstall {
|
||||
if ($ZabbixVersionInstalled -ne $null) {
|
||||
if ($ZabbixVersionInstalled -like "$SDZabbixVersion*") {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
if ((CheckZabbixInstall) -eq $true){
|
||||
Write-Host "Zabbix is currently up-to-date on this computer with the version stored in domain SYSVOL. No action is needed."
|
||||
} else {
|
||||
Write-Host "An upgrade to Zabbix was detected in domain SYSVOL."
|
||||
Write-Host "This computer has $ZabbixVersionInstalled installed. Upgrading to the newest version $SDZabbixVersion."
|
||||
try {
|
||||
msiexec /log "$InstallerLog" /i "$SoftwareDeployLocation" SERVER="$ZabbixServer" HOSTNAME=$env:COMPUTERNAME ENABLEPATH=1 /quiet
|
||||
} catch {
|
||||
Write-Error "Zabbix Agent could not be installed."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Stop-Transcript
|
71
MDT-JoinDomain.ps1
Normal file
71
MDT-JoinDomain.ps1
Normal file
@ -0,0 +1,71 @@
|
||||
# Script to join domain inside of MDT.
|
||||
# Technolog Networks, 2024-08-12
|
||||
# iRaven
|
||||
|
||||
# General necessities.
|
||||
$CompName = $env:COMPUTERNAME
|
||||
$TSEnv = New-Object -ComObject Microsoft.SMS.TSEnvironment
|
||||
$MDTPath = $Global:TSEnv.Value("DeployRoot")
|
||||
Start-Transcript -Path "$MDTPath\_Logs\$CompName-JoinDomain.log" -Append
|
||||
$CompType = $args[0]
|
||||
$SubType = $args[1]
|
||||
|
||||
if ($CompType -like "WKS") {
|
||||
New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\LSA" -Name NetJoinLegacyAccountReuse -Value 1
|
||||
$PCNamePrefix = ($CompName.Substring(0,$CompName.IndexOf("-")))
|
||||
# Domain credentials to join WKS to domain
|
||||
. "$MDTPath\_Scripts\Credentials-MDTJoinDomain.ps1"
|
||||
|
||||
Write-Host "Auto-detecting computer name $CompName..."
|
||||
# Filter out OUs
|
||||
if ($PCNamePrefix -like "XH") {
|
||||
Write-Host "Detected computer name as XH - domain joining to Personal WKS OU"
|
||||
$DomainOU = "OU=Personal,OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
elseif ($PCNamePrefix -like "TNG" -or $PCNamePrefix -like "NH" -or $PCNamePrefix -like "IR") {
|
||||
Write-Host "Detected computer name as TNG, NH, or IR - domain joining to Standard WKS OU"
|
||||
$DomainOU = "OU=Generic,OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
elseif ($PCNamePrefix -like "TEST") {
|
||||
Write-Host "Detected computer name as TEST - domain joining to Testing WKS OU"
|
||||
$DomainOU = "OU=TestingWKS,OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
else {
|
||||
Write-Host "Computer name is unusual - domain joining to Standard WKS OU"
|
||||
$DomainOU = "OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
} elseif ($CompType -like "Server") {
|
||||
$DomainCredential = Get-Credential -Message "To join this server to the domain, enter your domain credentials."
|
||||
# Filter out SubType var for server tiers
|
||||
if ($null -ne $SubType) {
|
||||
$DomainOU = "OU=$SubType,OU=Domain Servers,DC=technolog,DC=net"
|
||||
} else {
|
||||
$DomainOU = "OU=Domain Servers,DC=technolog,DC=net"
|
||||
}
|
||||
} elseif ($CompType -like "Utility") {
|
||||
. "$MDTPath\_Scripts\Credentials-MDTJoinDomain.ps1"
|
||||
|
||||
Write-Host "Domain joining to Utility OU"
|
||||
$DomainOU = "OU=Utility,DC=technolog,DC=net"
|
||||
} else {
|
||||
. "$MDTPath\_Scripts\Credentials-MDTJoinDomain.ps1"
|
||||
Write-Host "Domain joining to generic Computers OU"
|
||||
}
|
||||
|
||||
|
||||
if ([boolean](get-variable "DomainOU" -ErrorAction SilentlyContinue)) {
|
||||
try {
|
||||
Add-Computer -DomainName technolog.net -Credential $DomainCredential -OUPath $DomainOU -Restart
|
||||
} catch {
|
||||
Write-Host "Couldn't join the domain with OU $DomainOU"
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
Add-Computer -DomainName technolog.net -Credential $DomainCredential -Restart
|
||||
} catch {
|
||||
Write-Host "Couldn't join the domain!"
|
||||
}
|
||||
}
|
||||
|
||||
Stop-Transcript
|
8
MDT-PSCredentials.ps1
Normal file
8
MDT-PSCredentials.ps1
Normal file
@ -0,0 +1,8 @@
|
||||
$TSEnv = New-Object -ComObject Microsoft.SMS.TSEnvironment
|
||||
|
||||
$Username = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($Global:TSEnv.Value("SMSConnectNetworkFolderAccount")))
|
||||
$Password = ConvertTo-SecureString \"[System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($Global:TSEnv.Value("SMSConnectNetworkFolderPassword")))\" -AsPlainText -Force
|
||||
|
||||
$MDTCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $password
|
||||
|
||||
New-PSDrive -Name "PSCredentials" -PSProvider "FileSystem" -Root "\\berrypunch.technolog.net\PSCredentials$"
|
21
OEMInformation.bat
Normal file
21
OEMInformation.bat
Normal file
@ -0,0 +1,21 @@
|
||||
REM oem info script for tng
|
||||
|
||||
title OEM Info TNG
|
||||
|
||||
set /p manu=specify a computer manufacturer:
|
||||
set /p model=specify a computer model:
|
||||
|
||||
set regfile=c:\irnh\oeminfogentmp.reg
|
||||
|
||||
echo creating reg file...
|
||||
echo Windows Registry Editor Version 5.00 >> %regfile%
|
||||
echo\ >> %regfile%
|
||||
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation] >> %regfile%
|
||||
echo "Manufacturer"="%manu%" >> %regfile%
|
||||
echo "Model"="%model%" >> %regfile%
|
||||
:: echo "Logo"="c:\\irnh\\deioxpy-crop-120.bmp" >> %regfile%
|
||||
|
||||
echo NH OEMInformation script was ran %date% %time% on %computername% with options %manu% %model% %logopath% >> c:\irnh\oeminfo_log.txt
|
||||
|
||||
echo done. now applying the changes
|
||||
start %regfile%
|
20
Param-Test.ps1
Normal file
20
Param-Test.ps1
Normal file
@ -0,0 +1,20 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Joins this computer to the Technolog domain.
|
||||
.PARAMETER CompType
|
||||
The computer type. This can either be (w/o quotes) "WKS", or "Server".
|
||||
.PARAMETER ServerTier
|
||||
Can only be used with if CompType is "Server"- determines the tier of the server.
|
||||
#>
|
||||
|
||||
# Parameters
|
||||
param(
|
||||
[Parameter(Position=0,Mandatory=$true)]
|
||||
[string]$CompType = "None",
|
||||
[Parameter(Position=1,Mandatory=$false)]
|
||||
[string]$ServerTier = "None"
|
||||
)
|
||||
|
||||
|
||||
$CompType
|
||||
$ServerTier
|
9
Set-HPBIOSPassword.ps1
Normal file
9
Set-HPBIOSPassword.ps1
Normal file
@ -0,0 +1,9 @@
|
||||
# Script to set WKS BIOS password on HP systems.
|
||||
# Technolog Networks - 2024-08-12
|
||||
# iRaven
|
||||
|
||||
#Connect to the HP_BIOSSetting WMI class
|
||||
$HPBiosSettings = Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSSetting
|
||||
|
||||
#Check the status of the setup password
|
||||
$BIOSPasswordSet = ($HPBiosSettings | Where-Object Name -eq "Setup Password").IsSet
|
98
Set-PCBIOSPassword.ps1
Normal file
98
Set-PCBIOSPassword.ps1
Normal file
@ -0,0 +1,98 @@
|
||||
# Script to set BIOS password on a plethora of WKS systems.
|
||||
# Technolog Networks, 2024-09-15
|
||||
# iRaven
|
||||
|
||||
|
||||
# Import BIOS password credential file.
|
||||
. "\\berrypunch.technolog.net\PSCredentials$\Credentials-BIOSPasswords.ps1"
|
||||
# Domain Credentials to be used
|
||||
. "\\berrypunch.technolog.net\PSCredentials$\Credentials-WKSDeploy.ps1"
|
||||
# Computer OU in AD
|
||||
$ADCompOU = ([adsisearcher]"(&(objectClass=computer)(sAMAccountName=$CompName$))").FindOne().GetDirectoryEntry().distinguishedName
|
||||
|
||||
Function Get-PCManu { # Gets computer manufacturer from WMI query.
|
||||
# Check if HP
|
||||
If (Get-WmiObject -Query "SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE '%Hewlett-Packard%'") {
|
||||
Write-Host "Vendor detected as HP"
|
||||
return "HP"
|
||||
}
|
||||
elseif (Get-WmiObject -Query "SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE '%Dell%'") {
|
||||
Write-Host "Vendor detected as Dell"
|
||||
return "Dell"
|
||||
}
|
||||
elseif (Get-WmiObject -Query "SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE '%Lenovo%'") {
|
||||
Write-Host "Vendor detected as LenOwO"
|
||||
return "Lenowo"
|
||||
}
|
||||
}
|
||||
|
||||
Function Set-HPBIOSPW {
|
||||
#Connect to the HP_BIOSSetting WMI class
|
||||
$BIOSSettings = Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSSetting
|
||||
$BIOSInterface = Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSSettingInterface
|
||||
|
||||
#Check the status of the setup password, this returns a 1 or 0
|
||||
Write-Host "[HP] Getting status of BIOS Setup Password"
|
||||
$BIOSPasswordSet = ($BIOSSettings | Where-Object Name -eq "Setup Password").IsSet
|
||||
if ($BIOSPasswordSet -eq 0) { # Check if pw is not set
|
||||
Write-Host "[HP] Setup Password does not exist. Setting to current password."
|
||||
# Set the new (current) BIOS password from var
|
||||
$BIOSInterface.SetBIOSSetting("Setup Password","<utf-16/>" + "$WKSBIOSPassword","<utf-16/>")
|
||||
}
|
||||
elseif ($BIOSPasswordSet -eq 1) { # if password is already set
|
||||
Write-Host "[HP] Setup Password already exists!"
|
||||
Write-Host "[HP] Trying old password list then setting to the new one..."
|
||||
# Try different ones before the current one to set it to current password.
|
||||
# put for loop here
|
||||
$arrayindex=0
|
||||
while ($arrayindex -lt $OldBIOSPasswords.count) {
|
||||
while (Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet | Select-Object -ExpandProperty CurrentValue) {
|
||||
Set-Item -Path DellSmbios:\Security\AdminPassword "" -Password $OldBIOSPasswords[$arrayindex]
|
||||
}
|
||||
$arrayindex++
|
||||
}
|
||||
Write-Host "[HP] Lock was picked open. Setting to the new/current password."
|
||||
# After this finishes, set the new (current) password.
|
||||
$BIOSInterface.SetBIOSSetting("Setup Password","<utf-16/>" + "$WKSBIOSPassword","<utf-16/>" + "OldPassword")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Function Set-DellBIOSPW {
|
||||
# Check DellBIOSProvider module status
|
||||
try {
|
||||
Import-Module DellBIOSProvider
|
||||
} catch {
|
||||
Write-Host "[Dell] DellBIOSProvider module not installed, installing from PSGallery."
|
||||
Install-Module -Name DellBIOSProvider -Scope AllUsers -Force
|
||||
Import-Module DellBIOSProvider
|
||||
}
|
||||
# Check the status of the setup password, this returns True or False (yay)
|
||||
Write-Host "[Dell] Getting value of Admin Password status."
|
||||
$BIOSPasswordSet = (Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet | Select-Object -ExpandProperty CurrentValue)
|
||||
if (!$BIOSPasswordSet) {
|
||||
# Set the new (current) BIOS password from var
|
||||
Set-Item -Path DellSmbios:\Security\AdminPassword $WKSBIOSPassword
|
||||
Write-Host "[Dell] BIOS Admin Password was set."
|
||||
}
|
||||
elseif ($BIOSPasswordSet) {
|
||||
# Try different old passwords before setting it to the new/current password.
|
||||
Write-Host "[Dell] BIOS Admin password is already set!"
|
||||
Write-Host "[Dell] Trying old password list then setting to the new one..."
|
||||
$arrayindex=0
|
||||
while ($arrayindex -lt $OldBIOSPasswords.count) {
|
||||
while (Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet | Select-Object -ExpandProperty CurrentValue) {
|
||||
Set-Item -Path DellSmbios:\Security\AdminPassword "" -Password $OldBIOSPasswords[$arrayindex]
|
||||
}
|
||||
$arrayindex++
|
||||
}
|
||||
Write-Host "[Dell] Lock was picked open. Setting to the new/current password."
|
||||
# After this finishes, set the new (current) password.
|
||||
Set-Item -Path DellSmbios:\Security\AdminPassword $WKSBIOSPassword
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Function Set-LenovoBIOSPW {
|
||||
$BIOSPasswordSet = (Get-WmiObject -Namespace root\wmi -Class Lenovo_BiosPasswordSettings).PasswordState
|
||||
}
|
54
Standalone-JoinDomain.ps1
Normal file
54
Standalone-JoinDomain.ps1
Normal file
@ -0,0 +1,54 @@
|
||||
# Script to join domain inside of MDT.
|
||||
# Technolog Networks, 2024-08-21
|
||||
# iRaven
|
||||
|
||||
Start-Transcript -Path "c:\irnh\Standalone-JoinDomain.log" -Append
|
||||
|
||||
# General necessities.
|
||||
$CompName = $env:COMPUTERNAME
|
||||
|
||||
# Domain Credentials to be used
|
||||
. "\\berrypunch.technolog.net\PSCredentials$\Credentials-WKSDeploy.ps1"
|
||||
|
||||
$CompType = $args[0]
|
||||
$SubType = $args[1]
|
||||
|
||||
if ($CompType -like "WKS") {
|
||||
$PCNamePrefix = ($CompName.Substring(0,$CompName.IndexOf("-")))
|
||||
# Filter out OUs
|
||||
if ($PCNamePrefix -like "XH") {
|
||||
$DomainOU = "OU=Personal,OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
elseif ($PCNamePrefix -like "TNG" -or $PCNamePrefix -like "NH" -or $PCNamePrefix -like "IR") {
|
||||
$DomainOU = "OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
elseif ($PCNamePrefix -like "TEST") {
|
||||
$DomainOU = "OU=TestingWKS,OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
} elseif ($CompType -like "Server") {
|
||||
$DomainCredential = Get-Credential
|
||||
# Filter out SubType var for server tiers
|
||||
if ($SubType -ne $null) {
|
||||
$DomainOU = "OU=$SubType,OU=Domain Servers,DC=technolog,DC=net"
|
||||
} else {
|
||||
$DomainOU = "OU=Domain Servers,DC=technolog,DC=net"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ([boolean](get-variable "DomainOU" -ErrorAction SilentlyContinue)) {
|
||||
try {
|
||||
Add-Computer -DomainName technolog.net -Credential $DomainCredential -OUPath $DomainOU -Restart
|
||||
} catch {
|
||||
Write-Host "Couldn't join the domain with OU $DomainOU"
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
Add-Computer -DomainName technolog.net -Credential $DomainCredential -Restart
|
||||
} catch {
|
||||
Write-Host "Couldn't join the domain!"
|
||||
}
|
||||
}
|
||||
|
||||
Stop-Transcript
|
0
Start-HPIA.ps1
Normal file
0
Start-HPIA.ps1
Normal file
23
TNGAct-7P.bat
Normal file
23
TNGAct-7P.bat
Normal file
@ -0,0 +1,23 @@
|
||||
@echo off
|
||||
REM TNG Activate 7P SP1
|
||||
|
||||
ping 10.0.1.2
|
||||
ping technologsvr.technolog.net
|
||||
|
||||
echo Checking for elevation
|
||||
net config server
|
||||
if %errorlevel% neq 0 exit
|
||||
|
||||
cd %systemroot%\system32
|
||||
|
||||
cscript slmgr.vbs -ipk FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
|
||||
|
||||
REM timeout 5
|
||||
|
||||
cscript slmgr.vbs -skms 10.0.1.2
|
||||
|
||||
REM timeout 5
|
||||
|
||||
cscript slmgr.vbs -ato
|
||||
|
||||
REM timeout 15
|
129
TNGAct.bat
Normal file
129
TNGAct.bat
Normal file
@ -0,0 +1,129 @@
|
||||
@echo off
|
||||
setlocal
|
||||
REM TNG Activate
|
||||
|
||||
REM Initial checks
|
||||
echo Checking if you're connected to the Technolog internal network...
|
||||
REM ping 10.0.1.1
|
||||
ping 10.0.1.2
|
||||
if %errorlevel% neq 0 goto oops1
|
||||
ping technologsvr.technolog.net
|
||||
|
||||
echo Checking for elevation
|
||||
net config server
|
||||
if %errorlevel% neq 0 goto oops2
|
||||
|
||||
cd %systemroot%\system32
|
||||
goto ospicker
|
||||
|
||||
:ospicker
|
||||
REM Finds OS version
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "10.0" goto win10
|
||||
if "%version%" == "6.3" goto win81
|
||||
if "%version%" == "6.2" echo Windows 8 (regular) isn't supported currently.
|
||||
if "%version%" == "6.1" goto win7
|
||||
if "%version%" == "6.0" goto win6
|
||||
goto oops3
|
||||
|
||||
:win6
|
||||
echo winvista sucks but was detected
|
||||
rem pro key
|
||||
cscript slmgr.vbs -ipk YFKBB-PQJJV-G996G-VWGXY-2V3X8
|
||||
REM pause
|
||||
goto activate
|
||||
|
||||
:win7
|
||||
echo win7 dtected
|
||||
|
||||
set osver=Win7
|
||||
REM Pro key
|
||||
cscript slmgr.vbs -ipk FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
|
||||
|
||||
REM Enterprise key
|
||||
cscript slmgr.vbs -ipk 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
|
||||
|
||||
goto activate
|
||||
REM End 7
|
||||
:win81
|
||||
echo win81 detected
|
||||
|
||||
set osver=Win81
|
||||
REM Pro key
|
||||
cscript slmgr.vbs -ipk GCRJD-8NW9H-F2CDX-CCM8D-9D6T9
|
||||
|
||||
REM Enterprise Key
|
||||
cscript slmgr.vbs -ipk NPPR9-FWDCX-D2C8J-H872K-2YT43
|
||||
|
||||
goto activate
|
||||
REM End 81
|
||||
:win10
|
||||
echo win10 detected
|
||||
|
||||
set osver=Win10
|
||||
REM Pro key
|
||||
cscript slmgr.vbs -ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
|
||||
|
||||
REM Enterprise Key
|
||||
cscript slmgr.vbs -ipk NPPR9-FWDCX-D2C8J-H872K-2YT43
|
||||
|
||||
goto activate
|
||||
REM End 10
|
||||
|
||||
|
||||
:activate
|
||||
REM activation portion
|
||||
REM timeout 5
|
||||
|
||||
cscript slmgr.vbs -skms 10.0.1.2
|
||||
|
||||
REM timeout 5
|
||||
|
||||
cscript slmgr.vbs -ato
|
||||
if %errorlevel% neq 0 goto oops4
|
||||
|
||||
REM timeout 15
|
||||
echo TNG System Activated, %computername% - %osver% %date% %time% with %username% >> "\\technologsvr\batchlogs$\winactlog"
|
||||
|
||||
endlocal
|
||||
exit
|
||||
|
||||
REM Functions
|
||||
|
||||
:oops1
|
||||
REM Network Fail
|
||||
|
||||
cls
|
||||
color c
|
||||
echo You don't seem to be conneted to the TNG Network.
|
||||
echo Please connect to it to continue.
|
||||
timeout 5
|
||||
exit
|
||||
|
||||
:oops2
|
||||
REM Elevation Fail
|
||||
|
||||
color c
|
||||
echo You don't seem to be elevated, you twat. XD
|
||||
echo Elevation is required. Right click and run as admin, or contact your sysadmin.
|
||||
timeout 5
|
||||
exit
|
||||
|
||||
:oops3
|
||||
REM OS Unsupported
|
||||
|
||||
cls
|
||||
color c
|
||||
echo Your OS isn't recognized or supported.
|
||||
echo am confuse.
|
||||
timeout 5
|
||||
exit
|
||||
|
||||
:oops4
|
||||
REM Activation Fail
|
||||
|
||||
echo An error has occurred- please refer to the above for more information.
|
||||
echo Send to your local sysadmin if necesssary.
|
||||
pause
|
||||
exit
|
||||
|
133
TNGActS.bat
Normal file
133
TNGActS.bat
Normal file
@ -0,0 +1,133 @@
|
||||
@echo off
|
||||
setlocal
|
||||
REM TNG Activate
|
||||
|
||||
REM Initial checks
|
||||
echo Checking if you're connected to the Technolog internal network...
|
||||
REM ping 10.0.1.1
|
||||
ping 10.0.1.2
|
||||
if %errorlevel% neq 0 goto oops1
|
||||
ping technologsvr.technolog.net
|
||||
|
||||
echo Checking for elevation
|
||||
net config server
|
||||
if %errorlevel% neq 0 goto oops2
|
||||
|
||||
cd %systemroot%\system32
|
||||
goto ospicker
|
||||
|
||||
:ospicker
|
||||
REM Finds OS version
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "10.0" goto win10
|
||||
if "%version%" == "6.3" goto win81
|
||||
if "%version%" == "6.2" echo Windows 8 (regular) isn't supported currently.
|
||||
if "%version%" == "6.1" goto win7
|
||||
if "%version%" == "6.0" goto win6
|
||||
goto oops3
|
||||
|
||||
:win6
|
||||
echo haven't finished this
|
||||
pause
|
||||
exit
|
||||
|
||||
:win7
|
||||
echo win2k8r2 dtected
|
||||
|
||||
set osver=Win2008R2
|
||||
|
||||
REM Standard key
|
||||
cscript slmgr.vbs -ipk YC6KT-GKW9T-YTKYR-T4X34-R7VHC
|
||||
|
||||
REM Enterprise key
|
||||
cscript slmgr.vbs -ipk 489J6-VHDMP-X63PK-3K798-CPX3Y
|
||||
|
||||
REM Datacenter key
|
||||
cscript slmgr.vbs -ipk 74YFP-3QFB3-KQT8W-PMXWJ-7M648
|
||||
|
||||
goto activate
|
||||
REM End 7
|
||||
|
||||
:win81
|
||||
echo win2k12r2 detected
|
||||
|
||||
set osver=Win2012R2
|
||||
REM Standard key
|
||||
cscript slmgr.vbs -ipk D2N9P-3P6X9-2R39C-7RTCD-MDVJX
|
||||
|
||||
REM Datacenter Key
|
||||
cscript slmgr.vbs -ipk W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
|
||||
|
||||
goto activate
|
||||
REM End 81
|
||||
|
||||
:win10
|
||||
echo win2k16 or 19 or whatever detected
|
||||
|
||||
set osver=Win201619
|
||||
REM Standard key
|
||||
cscript slmgr.vbs -ipk WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY
|
||||
|
||||
REM Datacenter Key
|
||||
cscript slmgr.vbs -ipk CB7KF-BWN84-R7R2Y-793K2-8XDDG
|
||||
|
||||
goto activate
|
||||
REM End 10
|
||||
|
||||
|
||||
:activate
|
||||
REM activation portion
|
||||
REM timeout 5
|
||||
|
||||
cscript slmgr.vbs -skms 10.0.1.2
|
||||
|
||||
REM timeout 5
|
||||
|
||||
cscript slmgr.vbs -ato
|
||||
if %errorlevel% neq 0 goto oops4
|
||||
|
||||
REM timeout 15
|
||||
echo TNG Server System Activated, %computername% - %osver% %date% %time% with %logondomain%\%username% >> "\\technologsvr\batchlogs$\winactlog"
|
||||
|
||||
endlocal
|
||||
exit
|
||||
|
||||
REM Functions
|
||||
|
||||
:oops1
|
||||
REM Network Fail
|
||||
|
||||
cls
|
||||
color c
|
||||
echo You don't seem to be conneted to the TNG Network.
|
||||
echo Please connect to it to continue.
|
||||
timeout 5
|
||||
exit
|
||||
|
||||
:oops2
|
||||
REM Elevation Fail
|
||||
|
||||
color c
|
||||
echo You don't seem to be elevated, you twat. XD
|
||||
echo Elevation is required. Right click and run as admin, or contact your sysadmin.
|
||||
timeout 5
|
||||
exit
|
||||
|
||||
:oops3
|
||||
REM OS Unsupported
|
||||
|
||||
cls
|
||||
color c
|
||||
echo Your OS isn't recognized or supported.
|
||||
echo am confuse.
|
||||
timeout 5
|
||||
exit
|
||||
|
||||
:oops4
|
||||
REM Activation Fail
|
||||
|
||||
echo An error has occurred- please refer to the above for more information.
|
||||
echo Send to your local sysadmin if necesssary.
|
||||
pause
|
||||
exit
|
||||
|
119
TNGMeshInstaller.bat
Normal file
119
TNGMeshInstaller.bat
Normal file
@ -0,0 +1,119 @@
|
||||
@echo
|
||||
title TNG Mesh Installer
|
||||
:: Updated 2024-05-14
|
||||
|
||||
set batchlog=c:\irnh\schtask_log.txt
|
||||
|
||||
echo F Mesh Installer started @ %date% %time% >> %batchlog%
|
||||
|
||||
goto admincheck
|
||||
:: echo passing arguments if theres any! >> %batchlog%
|
||||
REM if "%~1"=="install" (
|
||||
REM echo install was passed >> %batchlog%
|
||||
REM goto admincheck
|
||||
REM )
|
||||
REM if "%~1"=="uninstall" (
|
||||
REM echo uninstall was passed >> %batchlog%
|
||||
REM goto admincheck
|
||||
REM )
|
||||
REM if "%~1"=="menu" goto admincheck
|
||||
rem echo none were passed! >> %batchlog%
|
||||
|
||||
:admincheck
|
||||
REM admin check made mandatory
|
||||
net config server >> nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo User not running with elevated rights %date% %time% >> %batchlog%
|
||||
echo You're not running as admin rights, you twat XD
|
||||
echo Press any key to exit
|
||||
pause >> nul
|
||||
echo L quitting installer at %date% %time% >> %batchlog%
|
||||
goto :eof
|
||||
)
|
||||
if %errorlevel% equ 0 (
|
||||
echo admin rights detected >> %batchlog%
|
||||
if "%~1"=="" {
|
||||
echo %~1 was passed >> %batchlog%
|
||||
goto menu
|
||||
)else goto %~1
|
||||
goto menu
|
||||
)
|
||||
|
||||
:menu
|
||||
choice /c AR /m "Add or Remove?"
|
||||
if %errorlevel% equ 1 (
|
||||
echo user chose install/add >> %batchlog%
|
||||
goto install
|
||||
)
|
||||
if %errorlevel% equ 2 (
|
||||
echo user chose uninstall/remove >> %batchlog%
|
||||
goto uninstall
|
||||
)
|
||||
|
||||
:install
|
||||
sc query "Mesh Agent"
|
||||
if %errorlevel% neq 0 (
|
||||
echo Mesh Agent was not detected >> %batchlog%
|
||||
:: start %cd%\meshagent64-TNG_Managed.exe -fullinstall
|
||||
if "%~2"=="tskoff" (
|
||||
echo script is likely running via group policy as task disable was passed. disabling installer task if the installer ran successfully @ %date% %time% >> %batchlog%
|
||||
schtasks.exe /Change /TN "NHMeshInstallTask" /Disable
|
||||
)
|
||||
if "%~2"=="wks" (
|
||||
echo Installing WKS Agent...
|
||||
start %cd%\meshagent64-NH-WKS.exe -fullinstall
|
||||
)
|
||||
if "%~2"=="srv"(
|
||||
echo Installing Server Agent...
|
||||
start %cd%\meshagent64-NH-Servers.exe -fullinstall
|
||||
echo L quitting installer at %date% %time% >> %batchlog%
|
||||
goto :eof
|
||||
)
|
||||
if %errorlevel% equ 0 (
|
||||
echo Mesh Agent is already installed >> %batchlog%
|
||||
echo Mesh Agent is already installed
|
||||
echo Checking if started and starting if not started... >> %batchlog%
|
||||
sc start "Mesh Agent"
|
||||
if %errorlevel% equ 1056 (
|
||||
echo Agent is already started >> %batchlog%
|
||||
rem color a
|
||||
echo Agent is already started
|
||||
)
|
||||
if "%~2"=="tskoff" (
|
||||
echo script is likely running via group policy as task disable was passed. disabling install task as mesh is installed on %computername% @ %date% %time% >> %batchlog%
|
||||
schtasks.exe /Change /TN "NHMeshInstallTask" /Disable
|
||||
)
|
||||
rem color a
|
||||
echo Quitting installer in 5 secs
|
||||
timeout 5
|
||||
echo L quitting installer at %date% %time% >> %batchlog%
|
||||
goto :eof
|
||||
)
|
||||
|
||||
:uninstall
|
||||
sc query "Mesh Agent"
|
||||
if %errorlevel% equ 0 (
|
||||
echo Mesh Agent was detected >> %batchlog%
|
||||
"%programfiles%\Mesh Agent\MeshAgent.exe -fulluninstall"
|
||||
if %errorlevel% neq 0 (
|
||||
color c
|
||||
echo Something happened - check the log %batchlog% for more info :p
|
||||
pause
|
||||
echo L quitting installer at %date% %time% >> %batchlog%
|
||||
goto :eof
|
||||
)
|
||||
if %errorlevel% equ 0 (
|
||||
color a
|
||||
echo Agent was successfully uninstalled >> %batchlog%
|
||||
echo Agent was uninstalled successfully
|
||||
pause
|
||||
echo L quitting installer at %date% %time% >> %batchlog%
|
||||
goto :eof
|
||||
)
|
||||
)
|
||||
if %errorlevel% neq 0 (
|
||||
echo Mesh Agent is already uninstalled >> %batchlog%
|
||||
echo Mesh Agent is already uninstalled
|
||||
pause
|
||||
echo L quitting installer at %date% %time% >> %batchlog%
|
||||
)
|
28
TNGMeshInstallerOU.ps1
Normal file
28
TNGMeshInstallerOU.ps1
Normal file
@ -0,0 +1,28 @@
|
||||
# Script to get current OU to install MeshCentral Agent.
|
||||
# Technolog Networks, 04/30/2024
|
||||
|
||||
# Define our AD searcher
|
||||
$adsearcher = New-Object System.DirectoryServices.DirectorySearcher
|
||||
|
||||
# Filter to return only computer objs
|
||||
$adsearcher.Filter = "(&(objectClass=computer)(samAccountName=$env:computername$))"
|
||||
|
||||
# Find the object in the directory
|
||||
$adobjpath = $adsearcher.FindOne()
|
||||
|
||||
# Return the LDAP path for the object
|
||||
$adobject = $adobjpath.GetDirectoryEntry()
|
||||
|
||||
# Stupid: get the OU of the computer by returning the parent object
|
||||
$computerou = $adobject.Parent
|
||||
|
||||
if ($computerou.Contains("OU=PersonalComputers")){
|
||||
echo "This is an XH system ($computerou)"
|
||||
./TNGMeshInstaller.bat install wks
|
||||
} elseif ($computerou.Contains("OU=Workstations")) {
|
||||
echo "This is WKS ($computerou)"
|
||||
./TNGMeshInstaller.bat install wks
|
||||
} elseif ($computerou.Contains("OU=Domain Servers")) {
|
||||
echo "This is a server ($computerou)"
|
||||
./TNGMeshInstaller.bat install srv
|
||||
}
|
104
TNGOfficeAct.bat
Normal file
104
TNGOfficeAct.bat
Normal file
@ -0,0 +1,104 @@
|
||||
@echo off
|
||||
setlocal
|
||||
REM TNG Microsoft Office Activate
|
||||
|
||||
REM Initial checks
|
||||
echo Checking if you're connected to the Technolog internal network...
|
||||
REM ping 10.0.1.1
|
||||
REM ping 10.0.1.2
|
||||
if %errorlevel% neq 0 goto oops1
|
||||
ping technologsvr.technolog.net
|
||||
|
||||
echo Checking for elevation
|
||||
net config server
|
||||
if %errorlevel% neq 0 goto oops2
|
||||
|
||||
cd %systemroot%\system32
|
||||
goto officepicker
|
||||
|
||||
:officepicker
|
||||
if exist "c:\program files (x86)\microsoft office\office12" goto office2007
|
||||
if exist "c:\program files (x86)\microsoft office\office14" goto office2010
|
||||
if exist "c:\program files (x86)\microsoft office\office15" goto office2013
|
||||
if exist "c:\program files (x86)\microsoft office\office16" goto office2016
|
||||
goto oops3
|
||||
|
||||
|
||||
:office2007
|
||||
set ofver=of2007
|
||||
set ofpath=office12
|
||||
echo %ofver% %ofpath%
|
||||
goto activate
|
||||
|
||||
:office2010
|
||||
set ofver=of2010
|
||||
set ofpath=office14
|
||||
echo %ofver% %ofpath%
|
||||
goto activate
|
||||
|
||||
:office2013
|
||||
set ofver=of2013
|
||||
set ofpath=office15
|
||||
echo %ofver% %ofpath%
|
||||
goto activate
|
||||
|
||||
:office2016
|
||||
set ofver=of2016
|
||||
set ofpath=office16
|
||||
echo %ofver% %ofpath%
|
||||
echo why the fuck are you using this? LOL
|
||||
goto activate
|
||||
|
||||
:activate
|
||||
REM activation portion
|
||||
REM timeout 5
|
||||
|
||||
cscript "c:\program files (x86)\microsoft office\%ofpath%\ospp.vbs" /sethst:technologsvr.technolog.net
|
||||
|
||||
cscript "c:\program files (x86)\microsoft office\%ofpath%\ospp.vbs" /act
|
||||
if %errorlevel% neq 0 goto oops4
|
||||
|
||||
REM timeout 15
|
||||
echo TNG Office Activated, %ofver% - %computername% %date% %time% with %logondomain%_%username% >> "\\technologsvr\batchlogs$\officeactlog"
|
||||
|
||||
endlocal
|
||||
goto :eof
|
||||
|
||||
REM Functions
|
||||
|
||||
:oops1
|
||||
REM Network Fail
|
||||
|
||||
cls
|
||||
color c
|
||||
echo You don't seem to be conneted to the TNG Network.
|
||||
echo Please connect to it to continue.
|
||||
timeout 5
|
||||
goto :eof
|
||||
|
||||
:oops2
|
||||
REM Elevation Fail
|
||||
|
||||
color c
|
||||
echo You don't seem to be elevated, you twat. XD
|
||||
echo Elevation is required. Right click and run as admin, or contact your sysadmin.
|
||||
timeout 5
|
||||
goto :eof
|
||||
|
||||
:oops3
|
||||
REM OS Unsupported
|
||||
|
||||
cls
|
||||
color c
|
||||
echo Your office isn't recognized or supported.
|
||||
echo am confuse.
|
||||
timeout 5
|
||||
goto :eof
|
||||
|
||||
:oops4
|
||||
REM Activation Fail
|
||||
|
||||
echo An error has occurred- please refer to the above for more information.
|
||||
echo Send to your local sysadmin if necesssary.
|
||||
pause
|
||||
goto :eof
|
79
Test-MDTScript.ps1
Normal file
79
Test-MDTScript.ps1
Normal file
@ -0,0 +1,79 @@
|
||||
# Testing MDT bullshit
|
||||
# Technolog Networks
|
||||
# iRaven
|
||||
|
||||
$CompName = $env:COMPUTERNAME
|
||||
Start-Transcript -Path "c:\$CompName-TESTScript.log" -Append
|
||||
|
||||
# General necessities.
|
||||
$TSEnv = New-Object -ComObject Microsoft.SMS.TSEnvironment
|
||||
|
||||
$CompType = $args[0]
|
||||
$SubType = $args[1]
|
||||
|
||||
Write-Host "Username: $env:username"
|
||||
Write-Host "MDT DeployRoot: $Global:TSEnv.Value("DeployRoot")"
|
||||
$MDTun = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($Global:TSEnv.Value("SMSConnectNetworkFolderAccount")))
|
||||
Write-Host "MDT UserName: $MDTun"
|
||||
|
||||
Read-Host -Prompt "Balls..."
|
||||
|
||||
if ($CompType -like "WKS") {
|
||||
$PCNamePrefix = ($CompName.Substring(0,$CompName.IndexOf("-")))
|
||||
# Domain credentials to join WKS to domain
|
||||
$MDTPath = $Global:TSEnv.Value("DeployRoot")
|
||||
. "$MDTPath\_Scripts\Credentials-MDTJoinDomain.ps1"
|
||||
|
||||
Write-Host "Auto-detecting computer name $CompName..."
|
||||
# Filter out OUs
|
||||
if ($PCNamePrefix -like "XH") {
|
||||
Write-Host "Detected computer name as XH - domain joining to Personal WKS OU"
|
||||
$DomainOU = "OU=Personal,OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
elseif ($PCNamePrefix -like "TNG" -or $PCNamePrefix -like "NH" -or $PCNamePrefix -like "IR") {
|
||||
Write-Host "Detected computer name as TNG, NH, or IR - domain joining to Standard WKS OU"
|
||||
$DomainOU = "OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
elseif ($PCNamePrefix -like "TEST") {
|
||||
Write-Host "Detected computer name as TEST - domain joining to Testing WKS OU"
|
||||
$DomainOU = "OU=TestingWKS,OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
else {
|
||||
Write-Host "Computer name is unusual - domain joining to Standard WKS OU"
|
||||
$DomainOU = "OU=Workstations,DC=technolog,DC=net"
|
||||
}
|
||||
} elseif ($CompType -like "Server") {
|
||||
$DomainCredential = Get-Credential -Message "To join this server to the domain, enter your domain credentials."
|
||||
# Filter out SubType var for server tiers
|
||||
if ($SubType -ne $null) {
|
||||
$DomainOU = "OU=$SubType,OU=Domain Servers,DC=technolog,DC=net"
|
||||
} else {
|
||||
$DomainOU = "OU=Domain Servers,DC=technolog,DC=net"
|
||||
}
|
||||
} elseif ($CompType -like "Utility") {
|
||||
. "z:\_Scripts\Credentials-MDTJoinDomain.ps1"
|
||||
|
||||
Write-Host "Domain joining to Utility OU"
|
||||
$DomainOU = "OU=Utility,DC=technolog,DC=net"
|
||||
} else {
|
||||
. "z:\_Scripts\Credentials-MDTJoinDomain.ps1"
|
||||
Write-Host "Domain joining to generic Computers OU"
|
||||
}
|
||||
|
||||
|
||||
if ([boolean](get-variable "DomainOU" -ErrorAction SilentlyContinue)) {
|
||||
try {
|
||||
Add-Computer -DomainName technolog.net -Credential $DomainCredential -OUPath $DomainOU -Restart
|
||||
} catch {
|
||||
Write-Host "Couldn't join the domain with OU $DomainOU"
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
Add-Computer -DomainName technolog.net -Credential $DomainCredential -Restart
|
||||
} catch {
|
||||
Write-Host "Couldn't join the domain!"
|
||||
}
|
||||
}
|
||||
|
||||
Stop-Transcript
|
9
Update-DebianNetinst.ps1
Normal file
9
Update-DebianNetinst.ps1
Normal file
@ -0,0 +1,9 @@
|
||||
# Script to update the debian netinst vmlinuz and initrd files on the netboot server.
|
||||
# Technolog Networks, 2025-03-26
|
||||
# iRaven
|
||||
|
||||
$DistroCodename = $args[0]
|
||||
|
||||
if ([boolean](get-variable "DistroCodename" -ErrorAction SilentlyContinue)) {
|
||||
cmd.exe /c "curl -L"
|
||||
}
|
23
Update-WinGet-Installer.ps1
Normal file
23
Update-WinGet-Installer.ps1
Normal file
@ -0,0 +1,23 @@
|
||||
# Script to update the winget installer (msixbundle) on a server that hosts it.
|
||||
# Technolog Networks, 2024-07-26
|
||||
# iRaven
|
||||
|
||||
Start-Transcript -Path "Update-WinGet-Installer.log" -Append
|
||||
|
||||
Write-Host "Checking latest version..."
|
||||
$WGLatestVer = (irm https://api.github.com/repos/microsoft/winget-cli/releases/latest).tag_name
|
||||
$WGDomainVer = type "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlatestver.txt"
|
||||
if ($WGDomainVer -eq $WGLatestVer) {
|
||||
# If the version we have on our domain controllers is the latest, don't do anything.
|
||||
Write-Host "Version is up to date. No changes were made"
|
||||
Stop-Transcript
|
||||
}
|
||||
else {
|
||||
# If the version we have on our domain controllers is NOT the latest, we have to get it online.
|
||||
cmd.exe /c "curl -L -o winget.msixbundle https://aka.ms/getwinget" # I hate IWR. lol
|
||||
cmd.exe /c "curl -L -o vclibs.14.00.Desktop.appx https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
|
||||
Copy-Item -Path "winget.msixbundle" "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\winget.msixbundle"
|
||||
$WGLatestVer > "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlatestver.txt"
|
||||
}
|
||||
|
||||
Stop-Transcript
|
0
Watchdog-DomainNetProf.ps1
Normal file
0
Watchdog-DomainNetProf.ps1
Normal file
83
adphotosync.ps1
Normal file
83
adphotosync.ps1
Normal file
@ -0,0 +1,83 @@
|
||||
[CmdletBinding(SupportsShouldProcess = $true)]Param()
|
||||
function Test-Null($InputObject) { return !([bool]$InputObject) }
|
||||
Function ResizeImage() {
|
||||
param([String]$ImagePath, [Int]$Quality = 90, [Int]$targetSize, [String]$OutputLocation)
|
||||
Add-Type -AssemblyName "System.Drawing"
|
||||
$img = [System.Drawing.Image]::FromFile($ImagePath)
|
||||
$CanvasWidth = $targetSize
|
||||
$CanvasHeight = $targetSize
|
||||
#Encoder parameter for image quality
|
||||
$ImageEncoder = [System.Drawing.Imaging.Encoder]::Quality
|
||||
$encoderParams = New-Object System.Drawing.Imaging.EncoderParameters(1)
|
||||
$encoderParams.Param[0] = New-Object System.Drawing.Imaging.EncoderParameter($ImageEncoder, $Quality)
|
||||
# get codec
|
||||
$Codec = [System.Drawing.Imaging.ImageCodecInfo]::GetImageEncoders() | Where { $_.MimeType -eq 'image/jpeg' }
|
||||
#compute the final ratio to use
|
||||
$ratioX = $CanvasWidth / $img.Width;
|
||||
$ratioY = $CanvasHeight / $img.Height;
|
||||
$ratio = $ratioY
|
||||
if ($ratioX -le $ratioY) {
|
||||
$ratio = $ratioX
|
||||
}
|
||||
$newWidth = [int] ($img.Width * $ratio)
|
||||
$newHeight = [int] ($img.Height * $ratio)
|
||||
$bmpResized = New-Object System.Drawing.Bitmap($newWidth, $newHeight)
|
||||
$graph = [System.Drawing.Graphics]::FromImage($bmpResized)
|
||||
$graph.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
$graph.Clear([System.Drawing.Color]::White)
|
||||
$graph.DrawImage($img, 0, 0, $newWidth, $newHeight)
|
||||
#save to file
|
||||
$bmpResized.Save($OutputLocation, $Codec, $($encoderParams))
|
||||
$bmpResized.Dispose()
|
||||
$img.Dispose()
|
||||
}
|
||||
|
||||
#get sid and photo for current user
|
||||
$user = ([ADSISearcher]"(&(objectCategory=User)(SAMAccountName=$env:username))").FindOne().Properties
|
||||
$user_photo = $user.thumbnailphoto
|
||||
$user_sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
|
||||
Write-Host "Updating account picture for $($user.displayname)..."
|
||||
#continue if an image was returned
|
||||
If ((Test-Null $user_photo) -eq $false) {
|
||||
Write-Host "Success. Photo exists in Active Directory."
|
||||
#set up image sizes and base path
|
||||
$image_sizes = @(32, 40, 48, 96, 192, 200, 240, 448, 1080)
|
||||
$image_mask = "Image{0}.jpg"
|
||||
$image_base = "C:\ProgramData\AccountPictures"
|
||||
#set up registry
|
||||
$reg_base = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\{0}"
|
||||
$reg_key = [string]::format($reg_base, $user_sid)
|
||||
$reg_value_mask = "Image{0}"
|
||||
If ((Test-Path -Path $reg_key) -eq $false) { New-Item -Path $reg_key }
|
||||
#save images, set reg keys
|
||||
ForEach ($size in $image_sizes) {
|
||||
#create hidden directory, if it doesn't exist
|
||||
$progdatadir = $image_base + "\" + $user_sid
|
||||
If ((Test-Path -Path $progdatadir) -eq $false) { $(mkdir $progdatadir).Attributes = "Hidden" }
|
||||
#save photo to disk, overwrite existing files
|
||||
$file_name = ([string]::format($image_mask, $size))
|
||||
$pathtmp = $dir + "\_" + $file_name
|
||||
$path = $dir + "\" + $file_name
|
||||
Write-Host " saving: $file_name"
|
||||
$user_photo | Set-Content -Path $pathtmp -Encoding Byte -Force
|
||||
ResizeImage $pathtmp $size $size $path
|
||||
Remove-Item $pathtmp
|
||||
#save the path in registry, overwrite existing entries
|
||||
$name = [string]::format($reg_value_mask, $size)
|
||||
$value = New-ItemProperty -Path $reg_key -Name $name -Value $path -Force
|
||||
}
|
||||
Write-Host ("Copying to Public Account Pictures")
|
||||
try {
|
||||
$PublicAccPicsDir = "C:\Users\Public\AccountPictures\" + "$user_sid"
|
||||
If ((Test-Path -Path $PublicAccPicsDir) -eq $false) {
|
||||
(mkdir $PublicAccPicsDir).Attributes = "Hidden"
|
||||
} else {
|
||||
rm "$PublicAccPicsDir\*.*"
|
||||
}
|
||||
Copy-Item $progdatadir\*.* "$PublicAccPicsDir\"
|
||||
} catch {
|
||||
Write-Host "Couldn't copy to Public Account Pictures!"
|
||||
}
|
||||
Write-Host "Done!"
|
||||
}
|
||||
else { Write-Error "No photo found in Active Directory for $env:username" }
|
39
domlogon.bat
Normal file
39
domlogon.bat
Normal file
@ -0,0 +1,39 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
title iR/TNG/NH Logon Script
|
||||
|
||||
set logonlog="\\technologsvr\batchlogs$\domlogonlog"
|
||||
set statlog="\\technologsvr\batchlogs$\domstatlog"
|
||||
|
||||
rem initial check, if error abort everything
|
||||
echo Checking if you're on the Technolog internal LAN
|
||||
ping 10.0.1.2 >nul
|
||||
ping technologsvr.technolog.net >nul
|
||||
if %errorlevel% neq 0 goto fuck
|
||||
|
||||
rem elevation?
|
||||
net config server
|
||||
if %errorlevel% neq 0 echo No elevation found, skipping
|
||||
|
||||
rem log to svr
|
||||
echo $$ System Logon: %username% on %computername% @ %time% %date% >> "\\technologsvr\batchlogs$\domlogonlog"
|
||||
echo System logon audited
|
||||
echo Polling stats...
|
||||
|
||||
net config workstation >> "\\technologsvr\batchlogs$\domstatlog"
|
||||
ipconfig >> "\\technologsvr\batchlogs$\domstatlog"
|
||||
REM net statistics workstation >> "\\technologsvr\batchlogs$\domstatlog"
|
||||
REM net statistics server >> "\\technologsvr\batchlogs$\domstatlog"
|
||||
gpresult /r >> "\\technologsvr\batchlogs$\domstatlog"
|
||||
gpresult >> "\\technologsvr\batchlogs$\domstatlog"
|
||||
|
||||
echo stats polled
|
||||
echo bye
|
||||
endlocal
|
||||
exit
|
||||
|
||||
:fuck
|
||||
echo You're not connected to the internal network- aborting
|
||||
endlocal
|
||||
exit
|
11
oeminfo.bat
Normal file
11
oeminfo.bat
Normal file
@ -0,0 +1,11 @@
|
||||
set /p manu=set manufacturer:
|
||||
set /p model=set model:
|
||||
|
||||
reg add HKLM\software\microsoft\windows\currentversion\oeminformation\logo /t REG_SZ /d "c:\irnh\horse_120.bmp"
|
||||
reg add HKLM\software\microsoft\windows\currentversion\oeminformation\Manufacturer /t REG_SZ /d %manu%
|
||||
reg add HKLM\software\microsoft\windows\currentversion\oeminformation\Model /t REG_SZ /d %model%
|
||||
reg add HKLM\software\microsoft\windows\currentversion\oeminformation\SupportHours /t REG_SZ /d "None, fuck off"
|
||||
reg add HKLM\software\microsoft\windows\currentversion\oeminformation\SupportPhone /t REG_SZ /d "867-5309"
|
||||
|
||||
|
||||
|
4
rayburn.bat
Normal file
4
rayburn.bat
Normal file
@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
if %username%==srayburn (
|
||||
start logoff
|
||||
)
|
18
truenas-proxmox.sh
Normal file
18
truenas-proxmox.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Checking if you are root"
|
||||
if [[ $EUID > 0 ]]; then
|
||||
echo "Not running as root, exiting"
|
||||
exit
|
||||
fi
|
||||
|
||||
apt-get install librest-client-perl git -y
|
||||
git clone https://github.com/TheGrandWazoo/freenas-proxmox
|
||||
|
||||
## Patches
|
||||
patch -b /usr/share/perl5/PVE/Storage/ZFSPlugin.pm < freenas-proxmox/perl5/PVE/Storage/ZFSPlugin.pm.patch
|
||||
patch -b /usr/share/pve-docs/api-viewer/apidoc.js < freenas-proxmox/pve-docs/api-viewer/apidoc.js.patch
|
||||
patch -b /usr/share/pve-manager/js/pvemanagerlib.js < freenas-proxmox/pve-manager/js/pvemanagerlib.js.patch
|
||||
cp -v freenas-proxmox/perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/
|
||||
mkdir /usr/share/perl5/REST
|
||||
cp -v freenas-proxmox/perl5/REST/Client.pm /usr/share/perl5/REST/
|
Loading…
x
Reference in New Issue
Block a user