Skip to content

Instantly share code, notes, and snippets.

View techdecline's full-sized avatar

Cornelius Schuchardt techdecline

View GitHub Profile
<#
.SYNOPSIS
Exports application objects from ConfigMgr.
.DESCRIPTION
Exports application objects from ConfigMgr from a local or remote Site Server.
Additionally, a filter can be used to export only a subset of applications.
.EXAMPLE
<#
.SYNOPSIS
Imports application objects to ConfigMgr.
.DESCRIPTION
Imports application objects from ConfigMgr from a local or remote Site Server.
.EXAMPLE
PS> Import-MyCMApplication -ExportLocation '\\siteserver2\Sources$\Applications\Import' -CMSiteCode SP1: -CMSiteServerFQDN siteserver1.contoso.com -Verbose
aram (
[Parameter(Mandatory)]
[ValidateScript({Test-Path $_})]
[String]$Source
)
# Uninstall old releases
Write-Verbose "Searching old TeamViewer releases installed using MSI Wrapper"
$tvArr = Get-WmiObject -Query 'Select Name,IdentifyingNumber from Win32_Product where Name like "TeamViewer%Wrapper%"'
<#
.Synopsis
Checks a given Profile Path for correct user ACL and ownership.
.DESCRIPTION
Checks a given Profile Path for correct user ACL and ownership and returns a boolean return value.
.EXAMPLE
PS> Check-ProfileACL -ProfilePath E:\Profiles\Alice.V6 -User contoso\alice
Evaluates ownership of "E:\Profiles\Alice.V6" (should be "BUILTIN\Administrators") and full control permissions for contoso\alice.
.EXAMPLE
$reservationArr = Get-DhcpServerv4Reservation -ScopeId 192.168.0.0 -ComputerName cm-dc1
foreach ($reservationObj in $reservationArr) {
Set-DhcpServerv4OptionValue -OptionId 66 -Value "bootserver1.decline.lab" -ReservedIP $reservationObj.IPAddress -ComputerName cm-dc1
Set-DhcpServerv4OptionValue -OptionId 67 -Value "/tftp/bootfile.0" -ReservedIP $reservationObj.IPAddress -ComputerName cm-dc1
}
Install-Script -Name Get-WindowsAutoPilotInfo -RequiredVersion 1.3
Get-InstalledScript
Get-InstalledScript | gm
Get-InstalledScript.installedlocation
(Get-InstalledScript).installedlocation
Mount-VHD -Path D:\vm\CM-Win10-AP.vhdx
Copy-Item -Path (Join-Path (get-installedscript).InstalledLocation -ChildPath Get-WindowsAutoPilotInfo.ps1) -Destination E:\
gci e:\
# Get all Farm Session Hosts
$sessionHostArr = Get-RDSessionCollection -ConnectionBroker rds-cb1.rds.lab | Get-RDSessionHost
foreach ($sessionHost in $sessionHostArr) {
$serverName = $sessionHost.SessionHost
Write-Verbose "Current Object is: $($sessionHost.SessionHost)"
# Test on SMB Protocol
if (-not (Test-NetConnection -ComputerName $serverName -Port 445)) {
# Test if target is online
if (-not (Test-WSMan $serverName)) {
<#
This script allows modification of local MDM policies.
It is based on Microsoft Documentation: https://docs.microsoft.com/en-us/windows/client-management/mdm/using-powershell-scripting-with-the-wmi-bridge-provider
Author: Cornelius Schuchardt, SoftEd Systems GmbH
#>
$namespaceName = "root\cimv2\mdm\dmmap"
$className = "MDM_Policy_Config01_Bluetooth02"
$instance = "Bluetooth"
$property = "AllowDiscoverableMode"
<#
.Synopsis
Get Group Policy Object Id that have been applied in the past
.DESCRIPTION
Get Group Policy Object Id that have been applied in the past
.EXAMPLE
Get-GpoHistory -Scope Machine
#>
function Get-GpoHistory
{