Skip to content

Instantly share code, notes, and snippets.

View littletoyrobots's full-sized avatar

Adam Yarborough littletoyrobots

View GitHub Profile
<#
.SYNOPSIS
Get-WinEvent with xml property expansion
.EXAMPLE
This will get user logoff events from localhost & 'target1' for user 'User42'
$WinEventParams = @{
ComputerName = $env:COMPUTERNAME, 'target1'
LogName = 'Security'
ID = 4647, 4634
Write-Verbose "Disable power saving on hardware network interfaces"
foreach ($NIC in (Get-NetAdapter -Physical)) {
$PowerSaving = Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi | Where-Object { $_.InstanceName -match [Regex]::Escape($NIC.PnPDeviceID) }
if ($PowerSaving.Enable) {
$PowerSaving.Enable = $false
$PowerSaving | Set-CimInstance *>&1
}
}
#Requires -Module PSWriteHtml
#Requires -PSSnapin Citrix.Broker.Admin.V2
# Author: Adam Yarborough, 2020.
# Usage: .\Create-CitrixApplicationReference.ps1 -AdminAddress 'ddc1.domain.com' -Outfile 'C:\Reports\Whatever.html'
[cmdletbinding()]
param (
[string]$AdminAddress = $env:COMPUTERNAME,
[switch]$IgnoreApplicationsWithNoUsers,
# Make an admin portal config file for your network printers web interfaces!
# This script will take the supplied print servers, and get a list of all their pritners from wmi. It will
# then look to see which of these printers have TCP/IP printer ports. If they do, I try and grab the IP
# address from their hostaddress, then barring that, the port name, and the comments. Then, for each of
# those printers that have a matching IP address, I'll test port 80 and 443 connections to them. I choose
# HTTP first, simply because in my org the HTTPS are all self-signed certs (I know). I also try and use the
# driver name to guess at the manufacturer and assign a picture as well.
# Categories will be grouped by print server, duplicates can exist, and this is probably the wrong way to
Add-PSSnapin Citrix.*
$IcoPath = "C:\Local\Google.ico"
$Icon = New-BrokerIcon -EncodedIconData ([convert]::ToBase64String((Get-Content $IcoPath -Encoding byte)))
$Params = @{
AdminAddress = "ddc1" # delivery controller
ApplicationType = "PublishedContent"
Name = "Google"
CommandLineExecutable = "https://google.com"
DesktopGroup = "Applications" # Just need a delivery group with resources
IconUid = $Icon.Uid