Adding 5 new scripts
This commit is contained in:
parent
b993fe380f
commit
f79ec27f1d
|
@ -347,5 +347,55 @@
|
|||
"default_timeout": "90",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):3rd Party Software"
|
||||
},
|
||||
{
|
||||
"guid": "3abbb62a-3757-492c-8979-b4fc6174845d",
|
||||
"filename": "Win_Disable_AutoRun.bat",
|
||||
"submittedBy": "https://github.com/silversword411",
|
||||
"name": "Disable Autorun",
|
||||
"description": "Disable Autorun System Wide",
|
||||
"shell": "cmd",
|
||||
"category": "TRMM (Win):Other",
|
||||
"default_timeout": "30"
|
||||
},
|
||||
{
|
||||
"guid": "4a11877a-7555-494c-ac74-29d6df3c1989",
|
||||
"filename": "Win_Disable_Cortana.bat",
|
||||
"submittedBy": "https://github.com/silversword411",
|
||||
"name": "Disable Cortana",
|
||||
"description": "Disable Cortana System Wide",
|
||||
"shell": "cmd",
|
||||
"category": "TRMM (Win):Other",
|
||||
"default_timeout": "30"
|
||||
},
|
||||
{
|
||||
"guid": "28ef1387-dd4f-4bab-b042-26250914e370",
|
||||
"filename": "Win_WOL_Enable_Status.ps1",
|
||||
"submittedBy": "https://github.com/silversword411",
|
||||
"name": "WoL - Enable function",
|
||||
"description": "Wake on Lan enable on Dell, HP, Lenovo",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):Network",
|
||||
"default_timeout": "90"
|
||||
},
|
||||
{
|
||||
"guid": "685d5432-0b84-46d5-98e8-3ec2054150fe",
|
||||
"filename": "Win_WOL_Test_State.ps1",
|
||||
"submittedBy": "https://github.com/silversword411",
|
||||
"name": "WoL - Test State",
|
||||
"description": "Wake on Lan test status",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):Network",
|
||||
"default_timeout": "90"
|
||||
},
|
||||
{
|
||||
"guid": "6ce5682a-49db-4c0b-9417-609cf905ac43",
|
||||
"filename": "Win_Win10_Change_Key_and_Activate.ps1",
|
||||
"submittedBy": "https://github.com/silversword411",
|
||||
"name": "Change Win10 Product Key and Activate",
|
||||
"description": "Insert new product key and Activate. Requires 1 parameter the product key you want to use",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):Other",
|
||||
"default_timeout": "90"
|
||||
}
|
||||
]
|
|
@ -0,0 +1 @@
|
|||
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDriveTypeAutoRun /t REG_DWORD /d 255 /f
|
|
@ -0,0 +1 @@
|
|||
reg add "hklm\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /d "AllowCortana"=dword:00000000
|
|
@ -0,0 +1,90 @@
|
|||
[CmdletBinding()]
|
||||
param ()
|
||||
|
||||
begin {
|
||||
$PPNuGet = Get-PackageProvider -ListAvailable | Where-Object { $_.Name -eq 'Nuget' }
|
||||
if (!$PPNuget) {
|
||||
Write-Output 'Installing Nuget provider'
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
}
|
||||
$PSGallery = Get-PSRepository -Name PsGallery
|
||||
if (!$PSGallery) {
|
||||
Write-Output 'Setting PSGallery as trusted Repository'
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
}
|
||||
$PsGetVersion = (Get-Module PowerShellGet).version
|
||||
if ($PsGetVersion -lt [version]'2.0') {
|
||||
Write-Output 'Installing latest version of PowerShellGet provider'
|
||||
Install-Module PowerShellGet -MinimumVersion 2.2 -Force
|
||||
Write-Output 'Reloading Modules'
|
||||
Remove-Module PowerShellGet -Force
|
||||
Remove-Module PackageManagement -Force
|
||||
Import-Module PowerShellGet -MinimumVersion 2.2 -Force
|
||||
Write-Output 'Updating PowerShellGet'
|
||||
Install-Module -Name PowerShellGet -MinimumVersion 2.2.3 -Force
|
||||
Write-Output 'PowerShellGet update requires all active PS Sessions to be restarted before it can continue.'
|
||||
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
|
||||
process {
|
||||
Write-Output 'Checking device Manufacturer'
|
||||
$Manufacturer = (Get-WmiObject -Class:Win32_ComputerSystem).Manufacturer
|
||||
if ($Manufacturer -like '*Dell*') {
|
||||
Write-Output 'Manufacturer is Dell. Installing Module and trying to enable Wake on LAN.'
|
||||
Write-Output 'Installing Dell Bios Provider'
|
||||
Install-Module -Name DellBIOSProvider -Force
|
||||
Import-Module DellBIOSProvider
|
||||
try {
|
||||
Set-Item -Path 'DellSmBios:\PowerManagement\WakeOnLan' -Value 'LANOnly' -ErrorAction Stop
|
||||
}
|
||||
catch {
|
||||
Write-Output 'An error occured. Was unable to set WakeOnLan.'
|
||||
|
||||
Exit 2
|
||||
}
|
||||
}
|
||||
if ($Manufacturer -like '*HP*' -or $Manufacturer -like '*Hewlett*') {
|
||||
Write-Output 'Manufacturer is HP. Installing module and trying to enable WakeOnLan. All HP Drivers are required for this operation to succeed.'
|
||||
Write-Output 'Installing HP Provider'
|
||||
Install-Module -Name HPCMSL -Force -AcceptLicense
|
||||
Import-Module HPCMSL
|
||||
try {
|
||||
$WolTypes = get-hpbiossettingslist | Where-Object { $_.Name -like '*Wake On Lan*' }
|
||||
ForEach ($WolType in $WolTypes) {
|
||||
Write-Output "Setting WOL Type: $($WOLType.Name)"
|
||||
Set-HPBIOSSettingValue -name $($WolType.name) -Value 'Boot to Hard Drive' -ErrorAction Stop
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Output 'An error occured. Was unable to set WakeOnLan.'
|
||||
|
||||
Exit 2
|
||||
}
|
||||
}
|
||||
if ($Manufacturer -like '*Lenovo*') {
|
||||
Write-Output 'Manufacturer is Lenovo. Trying to set via WMI. All Lenovo Drivers are required for this operation to succeed.'
|
||||
try {
|
||||
Write-Output 'Setting BIOS.'
|
||||
(Get-WmiObject -ErrorAction Stop -class 'Lenovo_SetBiosSetting' -namespace 'root\wmi').SetBiosSetting('WakeOnLAN,Primary') | Out-Null
|
||||
Write-Output 'Saving BIOS.'
|
||||
(Get-WmiObject -ErrorAction Stop -class 'Lenovo_SaveBiosSettings' -namespace 'root\wmi').SaveBiosSettings() | Out-Null
|
||||
}
|
||||
catch {
|
||||
Write-Output 'An error occured. Was unable to set WakeOnLan.'
|
||||
|
||||
Exit 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
Write-Output 'Setting NIC to enable WOL'
|
||||
$NicsWithWake = Get-CimInstance -ClassName 'MSPower_DeviceWakeEnable' -Namespace 'root/wmi'
|
||||
foreach ($Nic in $NicsWithWake) {
|
||||
Write-Output 'Enabling for NIC'
|
||||
Set-CimInstance $NIC -Property @{Enable = $true }
|
||||
}
|
||||
Exit 0
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
[CmdletBinding()]
|
||||
param ()
|
||||
|
||||
begin {
|
||||
$PPNuGet = Get-PackageProvider -ListAvailable | Where-Object { $_.Name -eq 'Nuget' }
|
||||
if (!$PPNuget) {
|
||||
Write-Output 'Installing Nuget provider'
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
}
|
||||
$PSGallery = Get-PSRepository -Name PsGallery
|
||||
if (!$PSGallery) {
|
||||
Write-Output 'Installing PSGallery'
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
}
|
||||
$PsGetVersion = (Get-Module PowerShellGet).version
|
||||
if ($PsGetVersion -lt [version]'2.0') {
|
||||
Write-Output 'Installing latest version of PowerShellGet provider'
|
||||
Install-Module PowerShellGet -MinimumVersion 2.2 -Force
|
||||
Write-Output 'Reloading Modules'
|
||||
Remove-Module PowerShellGet -Force
|
||||
Remove-Module PackageManagement -Force
|
||||
Import-Module PowerShellGet -MinimumVersion 2.2 -Force
|
||||
Write-Output 'Updating PowerShellGet'
|
||||
Install-Module -Name PowerShellGet -MinimumVersion 2.2.3 -Force
|
||||
Write-Output 'PowerShellGet update requires all active PS Sessions to be restarted before it can continue.'
|
||||
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
|
||||
process {
|
||||
Write-Output 'Checking Manufacturer'
|
||||
$Manufacturer = (Get-WmiObject -Class:Win32_ComputerSystem).Manufacturer
|
||||
if ($Manufacturer -like '*Dell*') {
|
||||
Write-Output 'Manufacturer is Dell. Installing Module and trying to get WOL state'
|
||||
Write-Output 'Installing Dell Bios Provider if needed'
|
||||
$Mod = Get-Module DellBIOSProvider
|
||||
if (!$mod) {
|
||||
Install-Module -Name DellBIOSProvider -Force
|
||||
}
|
||||
Import-Module DellBIOSProvider
|
||||
try {
|
||||
$WOLMonitor = Get-Item -Path 'DellSmBios:\PowerManagement\WakeOnLan' -ErrorAction SilentlyContinue
|
||||
if ($WOLMonitor.currentvalue -eq 'LanOnly') { $WOLState = 'Healthy' }
|
||||
}
|
||||
catch {
|
||||
Write-Output 'An error occured. Could not get WOL setting.'
|
||||
|
||||
Exit 3
|
||||
}
|
||||
}
|
||||
if ($Manufacturer -like '*HP*' -or $Manufacturer -like '*Hewlett*') {
|
||||
Write-Output 'Manufacturer is HP. Installing module and trying to get WOL State.'
|
||||
Write-Output 'Installing HP Provider if needed.'
|
||||
$Mod = Get-Module HPCMSL
|
||||
if (!$mod) {
|
||||
Install-Module -Name HPCMSL -Force -AcceptLicense
|
||||
}
|
||||
Import-Module HPCMSL
|
||||
try {
|
||||
$WolTypes = get-hpbiossettingslist | Where-Object { $_.Name -like '*Wake On Lan*' }
|
||||
$WOLState = ForEach ($WolType in $WolTypes) {
|
||||
Write-Output "Setting WOL Type: $($WOLType.Name)"
|
||||
get-HPBIOSSettingValue -name $($WolType.name) -ErrorAction Stop
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Output 'An error occured. Could not find WOL state'
|
||||
|
||||
Exit 3
|
||||
}
|
||||
}
|
||||
if ($Manufacturer -like '*Lenovo*') {
|
||||
Write-Output 'Manufacturer is Lenovo. Trying to get via WMI'
|
||||
try {
|
||||
Write-Output 'Getting BIOS.'
|
||||
$currentSetting = (Get-WmiObject -ErrorAction Stop -class 'Lenovo_BiosSetting' -namespace 'root\wmi') | Where-Object { $_.CurrentSetting -ne '' }
|
||||
$WOLStatus = $currentSetting.currentsetting | ConvertFrom-Csv -Delimiter ',' -Header 'Setting', 'Status' | Where-Object { $_.setting -eq 'Wake on lan' }
|
||||
$WOLStatus = $WOLStatus.status -split ';'
|
||||
if ($WOLStatus[0] -eq 'Primary') { $WOLState = 'Healthy' }
|
||||
}
|
||||
catch {
|
||||
Write-Output 'An error occured. Could not find WOL state'
|
||||
|
||||
Exit 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
$NicsWithWake = Get-CimInstance -ClassName 'MSPower_DeviceWakeEnable' -Namespace 'root/wmi' | Where-Object { $_.Enable -eq $False }
|
||||
if (!$NicsWithWake) {
|
||||
$NICWOL = 'Healthy - All NICs enabled for WOL within the OS.'
|
||||
Exit 0
|
||||
}
|
||||
else {
|
||||
$NICWOL = 'Unhealthy - NIC does not have WOL enabled inside of the OS.'
|
||||
Exit 4
|
||||
}
|
||||
if (!$WOLState) {
|
||||
$NICWOL = 'Unhealthy - Could not find WOL state'
|
||||
Exit 3
|
||||
}
|
||||
return $NICWOL
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
License Windows 10
|
||||
|
||||
.DESCRIPTION
|
||||
Insert License key into Windows 10 and activate
|
||||
|
||||
.NOTES
|
||||
For Windows installations in different languages, you will need to edit the following:
|
||||
Select-String -Pattern "^License Status:"
|
||||
and
|
||||
$LicenseStatus -match "Licensed"
|
||||
to match your specific language translation.
|
||||
|
||||
.FUNCTIONALITY
|
||||
PowerShell v3+
|
||||
#>
|
||||
|
||||
if ($Args.Count -eq 0) {
|
||||
Write-Output "New Product Key is Required"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$param1 = $args[0]
|
||||
|
||||
$OSKey = "$param1"
|
||||
$SLMgr = "C:\Windows\System32\slmgr.vbs"
|
||||
|
||||
Write-Output "Inserting license key: $OSKey"
|
||||
$InsertKey = & cscript $SLMgr /ipk $OSKey
|
||||
$RetryCount = 3
|
||||
|
||||
while ($RetryCount -gt 0) {
|
||||
Write-Output "Activating license key..."
|
||||
& cscript $SLMgr /ato
|
||||
|
||||
Write-Output "Verifying activation status"
|
||||
$SLMgrResult = & cscript $SLMgr /dli
|
||||
$LicenseStatus = ([string]($SLMgrResult | Select-String -Pattern "^License Status:")).Remove(0, 16)
|
||||
if ($LicenseStatus -match "Licensed") {
|
||||
Write-Host "Activation Successful" -ForegroundColor Green
|
||||
$retryCount = 0
|
||||
}
|
||||
else {
|
||||
Write-Error "Activation failed."
|
||||
$RetryCount -= 1
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue