This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Edit-RdpPort { | |
<# | |
.SYNOPSIS | |
Changes the port assigned to RDP | |
.DESCRIPTION | |
Change the port assigned to RDP by updating the registry and restarting relevant services | |
.PARAMETER ComputerName | |
ComputerName that will have its port changed | |
.PARAMETER Port | |
New port number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Usage: | |
## Import functions | |
# >. .\Set-ThisPcLibrary.ps1 | |
## Add library to 'This PC' | |
# >Set-ThisPcItem pictures | |
# Pictures | |
## Remove specific library | |
# >Set-ThisPcItem -Remove pic | |
# Pictures | |
## Remove all libraries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# duplicates indicate multiple processors | |
$Search = "OU=Domain servers,dc=contoso,dc=com" | |
Get-ADComputer -filter * -SearchBase $Search | Foreach-Object { | |
$property = "systemname","maxclockspeed","addressWidth","numberOfCores","NumberOfLogicalProcessors" | |
Get-WmiObject -computername $_.name -class win32_processor -Property $property -erroraction silentlycontinue | Select-Object -Property $property | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Generates a report of system configuration | |
.DESCRIPTION | |
Queries system properties using WMI and exports findings to an HTML file | |
.PARAMETER ComputerName | |
Specifies target. Defaults to local hostname | |
.PARAMETER FilePath | |
Specifies output path. Defaults to current location | |
.PARAMETER Open |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ExcludeDays = 90 # Exclude if password changed in the last $ days | |
$CutoffDate = (Get-Date).adddays(-($ExcludeDays)) | |
$Users = Get-ADUser -filter { | |
Enabled -eq $True -and | |
PasswordNeverExpires -eq $False -and | |
PasswordLastSet -lt $CutoffDate | |
} -Properties msDS-UserPasswordExpiryTimeComputed, PasswordLastSet, CannotChangePassword | |
$Users | Sort-Object -Property msDS-UserPasswordExpiryTimeComputed | Select-Object Name, PasswordLastSet, | |
@{ Name="ExpiryDate";Expression={ [datetime]::FromFileTime( $_."msDS-UserPasswordExpiryTimeComputed" ) } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ComputerName = Read-Host -Prompt 'Target' | |
$Cred = Get-Credential -Credential $null | |
Write-Host "Opening session with remote host" | |
$Session = New-PSSession -ComputerName $ComputerName -Credential $Cred -ErrorAction Stop | |
$Confirm = Read-Host "Are you sure that you want to delete all print jobs on $ComputerName (Y/N)" | |
if ( $Confirm -eq 'Y' ) { | |
Write-Host "1. Stopping spooler" -ForegroundColor Green |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$DateOffset = 30 | |
$StartDate = (Get-Date).adddays(-($DateOffset)) | |
$SearchBase = "OU=Domain Computers, DC=contoso, DC=com" | |
Get-ADComputer -Filter { | |
( LastLogonDate -gt $StartDate ) -and | |
( Name -ne "$env:COMPUTERNAME" ) | |
} -SearchBase $SearchBase -Properties LastLogonDate | | |
Sort-Object -Property LastLogonDate | | |
Format-Table -Property Name, LastLogonDate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shuts down computers without notice | |
$DateOffset = 30 | |
$StartDate = (Get-Date).AddDays(-($DateOffset)) | |
$SearchBase = "OU=Domain Computers, DC=contoso, DC=com" | |
Get-ADComputer -Filter { | |
( LastLogonDate -gt $StartDate ) -and | |
( Name -ne "$env:COMPUTERNAME" ) | |
} -SearchBase $SearchBase -Properties LastLogonDate | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ProcessName = "outlook" | |
$DateOffset = 30 | |
$StartDate = (Get-Date).AddDays(-($DateOffset)) | |
$SearchBase = "OU=Domain Computers, DC=contoso, DC=com" | |
Get-ADComputer -Filter { | |
( LastLogonDate -gt $StartDate ) -and | |
( Name -ne "$env:COMPUTERNAME" ) | |
} -SearchBase $SearchBase | | |
Foreach-Object { |
OlderNewer