Skip to content

Instantly share code, notes, and snippets.

@win2000b
win2000b / GetTeamsNumbers.ps1
Created April 14, 2022 10:52
Get List of Teams Numbers and export to CSV
# Install the Teams Module within PowerShell
Install-Module MicrosoftTeams
# Connect to Microsoft Teams PowerShell
Connect-MicrosoftTeams
#Get list of Users and export their details to csv
Get-CsOnlineUser -Filter {LineURI -ne $Null} | select DisplayName,LineURI,OnlineVoiceRoutingPolicy | Export-CSV c:\temp\teams.csv -NoTypeInformation
@win2000b
win2000b / Get-WindowsAutopilotinfo.ps1
Created November 9, 2020 15:28
Get AutoPilot Info Online
# At the OOBE, open a command prompt session. Shift F10
# Launch PowerShell
Powershell.exe
# Set PowerShell Execution Policy
Set-ExecutionPolicy bypass
# Install the AutoPilot Script
install-script get-windowsautopilotinfo
@win2000b
win2000b / Logon.ps1
Created October 16, 2020 15:27
Audit Logon / Logoff PowerShell
Param (
[string]$Computer = (Read-Host Remote computer name),
[int]$Days = 20
)
cls
$Result = @()
Write-Host "Gathering Event Logs, this can take awhile..."
$ELogs = Get-EventLog System -Source Microsoft-Windows-WinLogon -After (Get-Date).AddDays(-$Days) -ComputerName $Computer
If ($ELogs)
{ Write-Host "Processing..."
@win2000b
win2000b / RestartSearch.xml
Created September 16, 2020 07:41
Scheduled task to restart search service on WVD
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2020-09-15T15:31:06.0051067</Date>
<Author>DOMAIN\user</Author>
<URI>\Restart Windows Search Service</URI>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
@win2000b
win2000b / Removehold.ps1
Created August 10, 2020 08:48
Remove Holds and then query
$mailboxes = Get-Mailbox
foreach ($mailbox in $mailboxes)
{
set-mailbox $mailbox.Alias -removedelayholdapplied
set-mailbox $mailbox.Alias -removedelayreleaseholdapplied
}
$mailboxes = Get-Mailbox
foreach ($mailbox in $mailboxes)
@win2000b
win2000b / TeamsGuests.ps1
Created July 30, 2020 16:02
Query All Microsoft Teams and Export list of guests
# Connecting to Teams
Connect-MicrosoftTeams
# Connecting to Azure AD
Connect-AzureAD
#Get list of all Teams
$AllTeams = get-team
# For each team extract members
@win2000b
win2000b / DirectBillingToCSP.ps1
Last active August 2, 2022 19:57
Analyse Azure Resources Migration from Direct Billing to CSP
# First of all we are assuming we have delegated rights through CSP
# If we dont have delegated rights we need a login with reader rights in the customers subscription
# We then need 2 things. The Tenant ID of where the source subscription is located
# Then we need the subscription ID for the source subscription.
# If a customer has multiple subscriptions we will need the IDs for each and the script should be run for each.
# If you need to install Azure Module
Install-Module AzureRM
# Define these 2 variables.
@win2000b
win2000b / MSIextract.ps1
Created January 24, 2020 09:00
Get list of all MSI apps installed
get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage -AutoSize
@win2000b
win2000b / EdgeBookmarks.json
Created December 5, 2019 16:11
Edge Favourites JSON
[
{
"toplevel_name": "Company Bookmarks"
},
{
"url": "www.Company.co.uk",
"name": "Company Home Page"
},
{
"url": "https://login.citation.co.uk",
@win2000b
win2000b / GetLibraryID.ps1
Last active April 8, 2024 03:40
Get Library ID from SharePoint Document Library for Sync
# Optional, To get your tenant ID via PowerShell
Connect-msolservice
Get-MSOLCompanyInformation | select objectID
# Install SharePoint PowerShell If needed
Install-Module SharePointPnPPowerShellOnline
# Example https://$tenant.sharepoint.com/sites/$siteName
$tenant = 'Enter your Tenant Name in Here' # xxxx.onmicrosoft.com
$tenantId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' #Tenant ID, can be retrieved from Azure AD or PowerShell under optional.