Skip to content

Instantly share code, notes, and snippets.

@timbodv
timbodv / SampleSetMoeVersion.ps1
Created October 12, 2014 10:57
Sample script to set a MOE version value in the registry
param([string]$MOEVersion)
New-Item HKLM:SOFTWARE\MOE
New-ItemProperty HKLM:SOFTWARE\MOE -Name Version -Value "$MOEVersion"
$computerDetails = Get-WmiObject Win32_ComputerSystem
# clean up the manufacturer name
$manufacturer = $($computerDetails.Manufacturer)
$manufacturer = $manufacturer.Replace(" Inc.", "")
@timbodv
timbodv / GetSerialNumber.vbs
Created October 12, 2014 10:53
For use during the WinPE task sequence phase to get the serial number of the computer
' For use during the WinPE task sequence phase to get the serial number of the computer
Set taskSequenceEnvironment = CreateObject("Microsoft.SMS.TSEnvironment")
Set wmiService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set systemEnclosureCollection = wmiService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each systemEnclosureEntry in systemEnclosureCollection
taskSequenceEnvironment("SerialNumber") = systemEnclosureEntry.SerialNumber
Next
# get a list of licenses and plans
Get-MsolAccountSku | foreach { Write-Output "$($_.AccountSkuId)"; foreach ($status in $_.ServiceStatus) { Write-Output $status } }
# example to modify a user
$license = New-MsolLicenseOptions -AccountSkuId "tenant:STANDARDPACK" -DisabledPlans "MCOSTANDARD,EXCHANGE_S_STANDARD"
(Get-MsolUser)[1] | Set-MsolUserLicense -AddLicenses "tenant:STANDARDPACK"
(Get-MsolUser)[1] | Set-MsolUserLicense -LicenseOptions $license
@timbodv
timbodv / DscCleanSequencePc.ps1
Last active August 29, 2015 14:06
Sample DSC script for a clean sequencing PC
$config = @{
AllNodes = @(
@{
NodeName = "localhost";
PSDscAllowPlainTextPassword = $true
}
)}
Configuration SequencerTemplate
{