Skip to content

Instantly share code, notes, and snippets.

dsolodow / Send-TeamsChat.ps1
Created September 27, 2022 17:11
Send Teams chat via Graph PS
Import-Module Microsoft.Graph.Teams
$params = @{
ChatType = 'oneOnOne'
Members = @(
'@odata.type' = '#microsoft.graph.aadUserConversationMember'
Roles = @('owner')
'User@odata.bind' = "'UPN')"
#requires -modules UpdateServices
# Site configuration
$SiteCode = "CM1" # Site code
$ProviderMachineName = "siteServer.fqdn" # SMS Provider machine name
$WSUSName = "WSUS.server.fqdn" # SUP WSUS machine name (use FQDN)
$WSUSPortNumber = "8531" # SUP WSUS Port number (default for HTTPS is 8531, and 8530 for HTTP)
$WSUSSSL = $true # set to false if not using SSL for WSUS
# Import the ConfigurationManager.psd1 module
if((Get-Module ConfigurationManager) -eq $null) {
SELECT gcs.manufacturer0 AS Make
,IIF(gcs.manufacturer0 = 'Lenovo', gcsp.Version0, gcs.model0) AS Model
,COUNT(*) AS Count
INNER JOIN [CM_XXX].[dbo].[v_GS_COMPUTER_SYSTEM_PRODUCT] gcsp ON gcsp.ResourceID = gcs.ResourceID
GROUP BY Manufacturer0
WHEN gcs.Manufacturer0 = 'Lenovo'
THEN gcsp.Version0
ELSE gcs.Model0
dsolodow / Set-Signature.ps1
Last active April 21, 2022 17:28
PowerShell signature function
function Set-Signature {
Position = 0,
dsolodow / Sign-PSScript.ps1
Created June 13, 2020 23:34
PS script sign in VSCode
Register-EditorCommand -Name SignCurrentScript -DisplayName 'Sign Current Script' -ScriptBlock {
$cert = (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert)[0]
$currentFile = $psEditor.GetEditorContext().CurrentFile.Path
Set-AuthenticodeSignature -Certificate $cert -FilePath $currentFile
dsolodow / Add-TeamsFirewallRule.ps1
Created March 24, 2020 20:31
run as elevated; will create for each user who has profile on PC
Creates firewall rules for Teams.
(c) Microsoft Corporation 2018. All rights reserved. Script provided as-is without any warranty of any kind. Use it freely at your own risks.
Must be run with elevated permissions. Can be run as a GPO Computer Startup script, or as a Scheduled Task with elevated permissions.
The script will create a new inbound firewall rule for each user folder found in c:\users.
Requires PowerShell 3.0.
$dplog = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\SMS\DP\Logging\@GLOBAL' -name LogDirectory
New-SmbShare -Path $dplog -Name DP_LOG
icacls $dplog /grant "domain users:(oi)rx"
dsolodow / Get-WheelAnswer.ps1
Created November 20, 2018 19:04
Randomly select an IT pro answer.
Function Get-WheelAnswer
[string[]]$wheel = (
"Are you sure it's plugged in?",
"Move... I'll do it",
"Yes, just click OK",
"No, it's a scam, just delete it",
"The problem is on your end.",
"Yes, it's gone forever, that's what empty trash does.",
# blank prompt
set fish_greeting
# Colors:
set fish_color_normal F8F8F2 # the default color
set fish_color_command F92672 # the color for commands
set fish_color_quote E6DB74 # the color for quoted blocks of text
set fish_color_redirection AE81FF # the color for IO redirections
set fish_color_end F8F8F2 # the color for process separators like ';' and '&'
set fish_color_error F8F8F2 --background=F92672 # the color used to highlight potential errors
dsolodow / start-moduleCleanup.ps1
Created March 5, 2018 14:18
cleanup installed modules
Get-InstalledModule |
ForEach-Object {
$CurrentVersion = $PSItem.Version
Get-InstalledModule -Name $PSItem.Name -AllVersions |
Where-Object -Property Version -LT $CurrentVersion
} | Uninstall-Module -Verbose