Skip to content

Instantly share code, notes, and snippets.

View sub314xxl's full-sized avatar

Konstantin Mokhnatkin sub314xxl

  • Moscow, Russian Federation
View GitHub Profile
#requires -RunAsAdministrator
<#-----------------------------------------------------------------------------
Ashley McGlone, Microsoft Premier Field Engineer
http://aka.ms/goateepfe
February 2016
Install-ADModule
For Windows 10 performs the following tasks:
- Downloads and installs Windows 10 RSAT for the appropriate system architecture
- Enables the RSAT AD PowerShell feature
$servers = "dc1","dc3","sql1","wds1","ex1"
Foreach($s in $servers)
{
if(!(Test-Connection -Cn $s -BufferSize 16 -Count 1 -ea 0 -quiet))
{
Enable-PSRemoting -Force
Start-Service WinRM
Set-Item wsman:\localhost\client\trustedhosts * -Force
Get-WindowsFeature | Where-Object {$_.name -Like "*DNS*"}
$description = "Network Name"
$staticIp = ""
$subnetMask = ""
$gateway = ""
$adapter = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object { $_.Description -match $description}
$adapter | Invoke-CimMethod -Name EnableStatic -Arguments @{ IPAddress = $staticIp; SubnetMask = $subnetMask }
$adapter | Invoke-CimMethod -Name SetGateways -Arguments @{ DefaultIPGateway = $gateway; GatewayCostMetric = [UInt16] 1 }
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\NetworkConnectivityStatusIndicator" -Name "EnableActiveProbing" -Value "0" -PropertyType "Dword"
New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" -Name "EnableActiveProbing" -Value "0" -PropertyType "Dword"
(Get-WMIObject –query ‘SELECT * FROM SoftwareLicensingService’).OA3xOriginalProductKey
Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName . | Format-List TotalVirtualMemorySize,TotalVisibleMemorySize,FreePhysicalMemory,FreeVirtualMemory,FreeSpaceInPagingFiles
@sub314xxl
sub314xxl / gist:6c543fbfc0266e0548675568f9c57aee
Created March 14, 2018 14:17
CheckADGroupMembership.ps1
# Run from current user session
(New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:username)))")).FindOne().GetDirectoryEntry().memberOf | Select-String GROUP_NAME
$computerSystem = Get-CimInstance CIM_ComputerSystem
$computerBIOS = Get-CimInstance CIM_BIOSElement
$computerOS = Get-CimInstance CIM_OperatingSystem
$computerCPU = Get-CimInstance CIM_Processor
$computerHDD = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID = 'C:'"
Clear-Host
Write-Host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan
"Manufacturer: " + $computerSystem.Manufacturer
"Model: " + $computerSystem.Model
##########################################################
# Creating a bootable USB drive for installing Windows
# on UEFI / GPT systems
##########################################################
##########################################################
# Start by clearing the screen, tell user how to start
##########################################################
cls