- /Daily_Backup_review/database_s3_check.ps1 - /Daily_Backup_review/Get-StorageContainerContent.ps1 - /Daily_Backup_review/Global_Checks.ps1 - /Daily_Backup_review/list_table_within_databases.ps1 - /Daily_Backup_review/Start-AzureSQLExport.ps1 - /Daily_Backup_review/Start-BackupCheckBpScus.ps1 - /Daily_Backup_review/Start-BackupCheckBpWeu.ps1 - /Daily_Backup_review/Start-BackupCheckRoserAttachments.ps1 - /Daily_Backup_review/Start-BackupCheckRoserCloud.ps1 - /Daily_Backup_review/Start-BackupCheckTotal.ps1 - /Daily_Backup_review/Start-DatabaseExport.ps1 - /Daily_Backup_review/Start-PointInTimeRestore.ps1 - /Daily_Backup_review/list_databases_within_instances.py - /Daily_Citrix_VDA_and_Server_Utilization_review/Cloudwatch_review/cloudwatch_alarm_ap-southeast-2.json - /Daily_Citrix_VDA_and_Server_Utilization_review/Cloudwatch_review/Cloudwatch_review.ps1 - /Ansible/audit-netscaler-exp.yaml - /Ansible/concurrent-user.yaml - /Ansible/do-something.yaml - /Ansible/hello-world.yaml - /Ansible/p6-log-cleanup.yaml - /Ansible/Roser_DB_backup_one_off.yaml - /Ansible/test-sql.yaml - /Ansible/test-sql-double-creds.yaml - /RoserUsefull/access_bulk_servers.ps1 - /RoserUsefull/access_bulk_servers_cezar.ps1 - /RoserUsefull/Bulk_copy_files.ps1 - /RoserUsefull/Besfort_data.ps1 - /RoserUsefull/check_permissions_bulk_servers.ps1 - /RoserUsefull/Check-p6interface-checksum.ps1 - /RoserUsefull/compare_files.ps1 - /RoserUsefull/connections_parser.ps1 - /RoserUsefull/drop_rds_registry_key.ps1 - /RoserUsefull/EmergencyAccessRemote.ps1 - /RoserUsefull/Keycloak_TestConnection.ps1 - /RoserUsefull/Kickoff_disconnected_users.ps1 - /RoserUsefull/launch_jira.ps1 - /RoserUsefull/launch_jira_gui.ps1 - /RoserUsefull/ownership_taker_anonymized.ps1 - /RoserUsefull/purge_files.ps1 - /RoserUsefull/remove_local_profiles_PowerShell.PS1 - /RoserUsefull/retrieve_attachements.ps1 - /RoserUsefull/Send_patch_multiple_servers.ps1 - /RoserUsefull/Test-RSAAPI-BP.ps1 - /RoserUsefull/Linux_identify_big_files.sh
137 lines
5.5 KiB
PowerShell
137 lines
5.5 KiB
PowerShell
$s = New-PSSession -ComputerName RPVDA03 -Credential pgeeraert
|
|
|
|
Invoke-Command -Session $s -ScriptBlock { Get-Culture }
|
|
|
|
Invoke-Command -Session $s -ScriptBlock { hostname }
|
|
|
|
#check services
|
|
Invoke-Command -Session $s -ScriptBlock { get-service}
|
|
|
|
#check rdp services
|
|
Invoke-Command -Session $s -ScriptBlock { get-service TermService }
|
|
#check rdp services 's dependants
|
|
Invoke-Command -Session $s -ScriptBlock { get-service TermService -DependentServices }
|
|
#restrat them
|
|
Invoke-Command -Session $s -ScriptBlock { Restart-service UmRdpService }
|
|
Invoke-Command -Session $s -ScriptBlock { Restart-service ServicesManager }
|
|
Invoke-Command -Session $s -ScriptBlock { Restart-service TermService -force }
|
|
|
|
Invoke-Command -Session $s -ScriptBlock { start-service UmRdpService }
|
|
Invoke-Command -Session $s -ScriptBlock { start-service TermService }
|
|
Invoke-Command -Session $s -ScriptBlock { start-service ServicesManager }
|
|
|
|
#check LicenseManager services and dependants
|
|
Invoke-Command -Session $s -ScriptBlock { get-service LicenseManager }
|
|
|
|
#restart LicenseManager
|
|
Invoke-Command -Session $s -ScriptBlock { Restart-service LicenseManager }
|
|
|
|
#get firewall profiles
|
|
Invoke-Command -Session $s -ScriptBlock { Get-NetFirewallProfile }
|
|
|
|
#disable firewall
|
|
Invoke-Command -Session $s -ScriptBlock {netsh advfirewall set allprofiles state off }
|
|
#checlk firewall
|
|
Invoke-Command -Session $s -ScriptBlock {netsh advfirewall show all}
|
|
|
|
|
|
#checlk firewall rules
|
|
Invoke-Command -Session $s -ScriptBlock {Get-NetFirewallServiceFilter -Service termservice | Get-NetFirewallRule}
|
|
|
|
|
|
|
|
|
|
#Open port
|
|
Invoke-Command -Session $s -ScriptBlock {netsh advfirewall firewall add rule name="TCP Port 3389" dir=in action=allow protocol=TCP localport=3389}
|
|
Invoke-Command -Session $s -ScriptBlock {New-NetFirewallRule -DisplayName 'open rdp' -Profile 'Domain, Private, Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3389}
|
|
|
|
|
|
#check port
|
|
Invoke-Command -Session $s -ScriptBlock {get-NetFirewallRule -LocalOnlyMapping}
|
|
|
|
#check port
|
|
Invoke-Command -Session $s -ScriptBlock {netstat -ano | findStr "80"}
|
|
|
|
#check port
|
|
Invoke-Command -Session $s -ScriptBlock {netstat -ano | findStr "3389"}
|
|
|
|
#check port
|
|
Invoke-Command -Session $s -ScriptBlock {Get-NetTCPConnection -LocalPort 3389}
|
|
|
|
#check port
|
|
Invoke-Command -Session $s -ScriptBlock {Get-NetFirewallPortFilter | Where-Object -Property LocalPort -EQ 3389}
|
|
|
|
#check blocked port
|
|
Invoke-Command -Session $s -ScriptBlock {get-NetFirewallRule -Action Block}
|
|
|
|
#check NotConfigured port
|
|
Invoke-Command -Session $s -ScriptBlock {get-NetFirewallRule -Action NotConfigured}
|
|
|
|
#Invoke-Command -Session $s -ScriptBlock {new-item \\roser.rosercloud.app\d$\temp\Pierre_emergency_rpvda03\firewallrules.txt }
|
|
|
|
#check connectivity remotely
|
|
Invoke-Command -Session $s -ScriptBlock {tnc rpvda03 -port 3389}
|
|
|
|
#check connectivity remotely
|
|
Invoke-Command -Session $s -ScriptBlock {telnet 127.0.0.1 3389}
|
|
|
|
#get GPO
|
|
Invoke-Command -Session $s -ScriptBlock {Get-GPO -All}
|
|
|
|
#get date
|
|
Invoke-Command -Session $s -ScriptBlock {date}
|
|
|
|
#Get recent entries from an event log on the local computer
|
|
Invoke-Command -Session $s -ScriptBlock {Get-EventLog -LogName System -Newest 50}
|
|
|
|
#Get recent entries from an event log on the local computer
|
|
Invoke-Command -Session $s -ScriptBlock {Get-EventLog -LogName Application -Newest 50}
|
|
|
|
#Get all events that include a specific word in the message
|
|
Invoke-Command -Session $s -ScriptBlock {Get-EventLog -LogName Application -Message *TermService*}
|
|
|
|
|
|
Invoke-Command -Session $s -ScriptBlock {Get-WinEvent -FilterHashTable @{LogName='Microsoft-Windows-TerminalServices-RDPClient/Operational'} | Select-Object $properties}
|
|
|
|
# determine the current RDP por
|
|
Invoke-Command -Session $s -ScriptBlock {Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"}
|
|
|
|
# change the current RDP por
|
|
Invoke-Command -Session $s -ScriptBlock {
|
|
$portvalue=3389
|
|
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue
|
|
}
|
|
|
|
|
|
#change the default port value
|
|
Invoke-Command -Session $s -ScriptBlock {
|
|
$portvalue = 3389
|
|
|
|
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue
|
|
|
|
New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue
|
|
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue
|
|
Restart-service UmRdpService
|
|
Restart-service TermService -force
|
|
tnc rpvda03 -port $portvalue
|
|
}
|
|
|
|
# ping 8.8.8.8
|
|
Invoke-Command -Session $s -ScriptBlock {ping 8.8.8.8}
|
|
|
|
Invoke-Command -Session $s -ScriptBlock {
|
|
$properties = @( @{n='TimeStamp';e={$_.TimeCreated}} @{n='LocalUser';e={$_.UserID}} @{n='Target RDP host';e={$_.Properties[1].Value}} ) Get-WinEvent -FilterHashTable @{LogName='Microsoft-Windows-TerminalServices-RDPClient/Operational';ID='1102'} | Select-Object $properties
|
|
}
|
|
|
|
|
|
Invoke-Command -Session $s -ScriptBlock {Get-WmiObject -Class Win32_Service -Filter "Name LIKE 'TermService'" }
|
|
Invoke-Command -Session $s -ScriptBlock {
|
|
|
|
|
|
$id = Get-WmiObject -Class Win32_Service -Filter "Name LIKE 'TermService'" |
|
|
Select-Object -ExpandProperty ProcessId
|
|
Get-WmiObject -Class Win32_Service -Filter "Name LIKE 'TermService'"
|
|
$process = Get-Process -Id $id
|
|
$process
|
|
#kill $process
|
|
} |