Update 44 files
- /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
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
|
||||
257330426:100030334880655:Precious:Anderson:female:::::1/1/0001 12:00:00 AM::
|
||||
12257330428:23401637:Michael:Scott:male:New Orleans, Louisiana:::MPATH:2/18/2019 12:00:00 AM:michaelscottnow@gmail.com:
|
||||
12257330435:100000056357274:Byron:Stewart::::::2/2/2019 12:00:00 AM::
|
||||
12257330442:100006427414396:Bw:Bezzy:male:Baton Rouge, Louisiana:Baton Rouge, Louisiana:In a relationship:Get Money Group:2/18/2019 12:00:00 AM::
|
||||
12257330443:100000128437045:Deon:Abram:female:::::2/7/2019 12:00:00 AM::
|
||||
12257330444:100004509129746:Tracy:Taylor:female:Baton Rouge, Louisiana:Napoleonville, Louisiana::Amelia Belle Casino:1/1/0001 12:00:00 AM::
|
||||
12257330451:100000886175617:Phyllis:Arnold:female::::McDonald's:7/24/2014 12:00:00 AM::
|
||||
12257330452:100033201966803:Synia:Trosclair:male:::::1/1/0001 12:00:00 AM::
|
||||
12257330459:100005763072394:Og:Ynwr:male:Baton Rouge, Louisiana::::1/31/2018 12:00:00 AM::
|
||||
12257330461:100025642684110:Marvin:Johnson:male:::::7/11/2018 12:00:00 AM::
|
||||
12257330463:100002187119260:Charles:Walker:male:::::11/17/2017 12:00:00 AM::
|
||||
12257330466:100000526863925:Willie:Adams:male:Baton Rouge, Louisiana:Baton Rouge, Louisiana:In a relationship:U.S. Marine Corps:12/29/2018 12:00:00 AM::
|
||||
12257330469:100010056549366:Dwayne:Knighten:female:::::1/1/0001 12:00:00 AM::
|
||||
12257330474:100002586004515:Briian:Johnson:male::New Orleans, Louisiana:::6/3/2012 12:00:00 AM::
|
||||
12257330477:100011329301982:Auntree:Brown:female:::::4/10/2017 12:00:00 AM::
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
$DebugPreference = "continue"
|
||||
$Exclude = 'Account-IT','p6integrationapi','p6integrationapi_1','Primavera P6'
|
||||
$Executionenvironment = 'production'
|
||||
|
||||
$V21_12_pro_jar_sites = 'Donges','portarthur'
|
||||
|
||||
$sites = Get-ChildItem "C:\roserapps\" -Exclude $Exclude
|
||||
$sites | ForEach-Object {
|
||||
Write-debug $psitem.name
|
||||
$fullName = $psitem.name
|
||||
|
||||
if($Executionenvironment -eq 'production'){
|
||||
$JarFile = 'V17.12.pro.Azure.jar'
|
||||
if($V21_12_pro_jar_sites -contains $fullName ){
|
||||
$JarFile = 'V21.12.pro.jar'
|
||||
}
|
||||
|
||||
}else{
|
||||
$JarFile = 'V21.12.pro.jar'
|
||||
}
|
||||
Write-Host $JarFile -ForegroundColor green
|
||||
certutil -hashfile "C:\roserapps\$fullName\rosersuite\P6 interface\$JarFile" SHA1
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
$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
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
$Realm='ZR'
|
||||
$Keycloak_Server = "https://keycloak.roser-ict.com"
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$CLientID = 'CLientID'
|
||||
$ClientSecret = 'ClientSecret'
|
||||
if(-not $ClientSecret) {
|
||||
Write-Error 'Please configure $ClientSecret' -ErrorAction STOP
|
||||
}
|
||||
|
||||
$RequestURL = $Keycloak_Server + "/auth/realms/$Realm/protocol/openid-connect/token"
|
||||
|
||||
$body = @{
|
||||
grant_type='client_credentials'
|
||||
client_id=$ClientID
|
||||
client_secret=$ClientSecret
|
||||
}
|
||||
|
||||
# Token Request
|
||||
$result = Invoke-WebRequest -Method POST -Uri $RequestURL -ContentType "application/x-www-form-urlencoded" -Body $body
|
||||
|
||||
$Content = $result.Content | ConvertFrom-Json
|
||||
$APIurl = 'https://totalzr-rsa-acc.roser-ict.com/api/configuration/languages'
|
||||
$Params = @{
|
||||
"URI" = $APIurl
|
||||
"Method" = 'GET'
|
||||
"Headers" = @{
|
||||
"Content-Type" = 'application/json'
|
||||
"Authorization" = "Bearer $($Content.access_token)"
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-RestMethod @Params
|
||||
@@ -0,0 +1,10 @@
|
||||
$disconnected_users = qwinsta | select-string "Disc" | select-string -notmatch "services"
|
||||
|
||||
if ($disconnected_users )
|
||||
{
|
||||
$disconnected_users|ForEach-Object{
|
||||
write-output "kickoff of :"
|
||||
write-output ($_.tostring() -split ' +')[1]
|
||||
logoff ($_.tostring() -split ' +')[2]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
$VerbosePreference='continue'
|
||||
######################################################################################
|
||||
#
|
||||
# Servers you want to connect
|
||||
#
|
||||
######################################################################################
|
||||
|
||||
$list_of_server_to_connect = @("BP-srvapp25","BP-srvapp26","BP-srvapp27")
|
||||
|
||||
|
||||
|
||||
######################################################################################
|
||||
#
|
||||
# Command to type
|
||||
#
|
||||
######################################################################################
|
||||
|
||||
#if password is required
|
||||
#$username =
|
||||
#$password =
|
||||
$Source_patch_folder = "C:\Users\pgeeraert_a\Desktop\2020.01.44.216\Roser Suite\RoserSuite_2020.01_Release_x64_216\"
|
||||
$Destination_patch_folder = "C:\Users\pgeeraert_a\Desktop"
|
||||
|
||||
foreach($server in $list_of_server_to_connect){
|
||||
|
||||
#--Uncomment if password is required
|
||||
#$pw = convertto-securestring -AsPlainText -Force -String $password
|
||||
#$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$pw
|
||||
#$Session = New-PSSession -ComputerName $server -Credential $cred
|
||||
#--
|
||||
|
||||
#--Comment if password i srequired
|
||||
$Session = New-PSSession -ComputerName $server
|
||||
#--
|
||||
|
||||
write-output "connecting to $server"
|
||||
Copy-Item $Source_patch_folder -Destination $Destination_patch_folder -ToSession $Session -Recurse -Force
|
||||
|
||||
write-output "Copy of $server done"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
|
||||
# Keycloak Server
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$Keycloak_Server = 'https://keycloak-acc-bp-weu.roser-ict.com',
|
||||
|
||||
# ClientID From Keycloak
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$ClientID = 'BP_Rotterdam',
|
||||
|
||||
# ClientSecret From Keycloak
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$ClientSecret = 'a2bb4f34-d415-4cba-807f-c68a41b9cb3c',
|
||||
|
||||
# Keycloak Realm
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$Realm='BP_Rotterdam'
|
||||
|
||||
)
|
||||
|
||||
|
||||
$VerbosePreference='continue'
|
||||
|
||||
# Example Powershell Code for connecting to the API and retrieving supported languages
|
||||
$APIswagger = 'https://api-acc-bp-weu.roser-ict.com/api/welding/swagger.yml'
|
||||
$APIlanguages = 'https://api-acc-bp-weu.roser-ict.com/api/configuration/languages'
|
||||
$APIwelding = 'https://api-acc-bp-weu.roser-ict.com/api/welding/report'
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
if(-not $ClientSecret) {
|
||||
Write-Error 'Please configure $ClientSecret' -ErrorAction STOP
|
||||
}
|
||||
|
||||
$RequestURL = $Keycloak_Server + "/auth/realms/$Realm/protocol/openid-connect/token"
|
||||
|
||||
$body = @{
|
||||
grant_type='client_credentials'
|
||||
client_id=$ClientID
|
||||
client_secret=$ClientSecret
|
||||
}
|
||||
|
||||
# Token Request
|
||||
$result = Invoke-WebRequest -Method POST -Uri $RequestURL -ContentType "application/x-www-form-urlencoded" -Body $body
|
||||
$Content = $result.Content | ConvertFrom-Json
|
||||
|
||||
$Params = @{
|
||||
"URI" = $APIswagger
|
||||
"Method" = 'GET'
|
||||
"Headers" = @{
|
||||
"Content-Type" = 'application/json'
|
||||
"Authorization" = "Bearer $($Content.access_token)"
|
||||
}
|
||||
}
|
||||
$Swagger = Invoke-RestMethod @Params
|
||||
|
||||
Write-Output $Swagger
|
||||
|
||||
|
||||
$Params = @{
|
||||
"URI" = $APIlanguages
|
||||
"Method" = 'GET'
|
||||
"Headers" = @{
|
||||
"Content-Type" = 'application/json'
|
||||
"Authorization" = "Bearer $($Content.access_token)"
|
||||
}
|
||||
}
|
||||
Invoke-RestMethod @Params
|
||||
|
||||
$Params = @{
|
||||
"URI" = $APIwelding
|
||||
"Method" = 'POST'
|
||||
"Headers" = @{
|
||||
"Content-Type" = 'application/json'
|
||||
"Authorization" = "Bearer $($Content.access_token)"
|
||||
}
|
||||
}
|
||||
Invoke-RestMethod @Params -Verbose
|
||||
|
||||
$Params.Method = 'GET'
|
||||
$WelditReports = Invoke-RestMethod @Params -Verbose
|
||||
|
||||
write-output "Received $($WelditReports.Count) Reports"
|
||||
@@ -0,0 +1,9 @@
|
||||
get-adcomputer -filter * | ForEach-Object {
|
||||
|
||||
Invoke-Command -ComputerName $psitem.DnsHostName -ScriptBlock {
|
||||
Get-Service *roser*;
|
||||
|
||||
#get-service *push*;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
$VerbosePreference='continue'
|
||||
######################################################################################
|
||||
#
|
||||
# Servers you want to connect
|
||||
#
|
||||
######################################################################################
|
||||
|
||||
$list_of_server_to_connect = [ordered]@{
|
||||
"te-prd-app-01" = [PSCustomObject]@{
|
||||
"Name"="te-prd-app-01.roser-total.local"
|
||||
"username"="roser-total\pgeeraert"
|
||||
"password"="Pr0m3th3us!!"
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################################
|
||||
#
|
||||
# Command to type
|
||||
#
|
||||
######################################################################################
|
||||
|
||||
$command_to_type = hostname
|
||||
|
||||
|
||||
|
||||
|
||||
$pw = convertto-securestring -AsPlainText -Force -String "Pr0m3th3us!!"
|
||||
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "roser-total\pgeeraert",$pw
|
||||
$server_to_connect = $list_of_server_to_connect.$server.Name
|
||||
$session = New-PSSession -ComputerName $server_to_connect -Credential $cred
|
||||
Invoke-Command -Session $session -ScriptBlock { hostname }
|
||||
|
||||
<#
|
||||
foreach($server in $list_of_server_to_connect.keys){
|
||||
write-output $server
|
||||
write-output $list_of_server_to_connect.$server.Name
|
||||
$pw = convertto-securestring -AsPlainText -Force -String $list_of_server_to_connect.$server.password
|
||||
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $list_of_server_to_connect.$server.username,$pw
|
||||
|
||||
$server_to_connect = $list_of_server_to_connect.$server.Name
|
||||
$session = New-PSSession -ComputerName $server_to_connect -Credential $cred
|
||||
Invoke-Command -Session $session -ScriptBlock { hostname }
|
||||
}
|
||||
|
||||
#get the target
|
||||
#>
|
||||
@@ -0,0 +1,20 @@
|
||||
$VerbosePreference = 'continue'
|
||||
get-adcomputer -Filter 'Name -like "te-prd-app-*"' | ForEach-Object {
|
||||
Write-Verbose $PSItem.name
|
||||
Invoke-Command -ComputerName $psitem.DnsHostName -ScriptBlock {
|
||||
hostname;
|
||||
$VerbosePreference = 'continue'
|
||||
|
||||
$sites = "antwerp","donges","feyzin","grandpuits","leuna","normandie","portarthur"
|
||||
|
||||
foreach($site in $sites){
|
||||
|
||||
Write-Verbose $site
|
||||
if((Get-ACl C:\roserapps\$site).Access | Where-Object {$_.IdentityReference -eq "ROSER-TOTAL\NFZ_$site"}){
|
||||
(Get-ACl C:\roserapps\$site).Access | Where-Object {$_.IdentityReference -eq "ROSER-TOTAL\NFZ_$site"}}
|
||||
else{
|
||||
write-error "not there"}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
get-adcomputer -filter "name -like 'tot-ctx-*'" | ForEach-Object {
|
||||
|
||||
Get-FileHash -Path "\\$($Psitem.DnsHostname)\c$\P6IntegrationAPI_1\BREBootStrap.xml"
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
$file = "C:\Users\pgeeraert\Downloads\connections.xml"
|
||||
$destination = Get-content $file
|
||||
|
||||
|
||||
$data = foreach ($line in $destination) {
|
||||
$info = $line -split "\s+"
|
||||
$hash = [ordered]@{}
|
||||
for ($i=0;$i -lt $names.count;$i++) {
|
||||
$hash.add($names[$i],$Info[$i])
|
||||
} #end For
|
||||
[pscustomobject]$hash
|
||||
} #end Foreach
|
||||
|
||||
$data
|
||||
@@ -0,0 +1 @@
|
||||
$reg_key_to_delete = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod\' | Select-Object L$RTM*
|
||||
@@ -0,0 +1,14 @@
|
||||
$VerbosePreference = "continue"
|
||||
$Jira_number = Read-Host ""
|
||||
|
||||
if(-Not($Jira_number -like "DEPLOY*")){
|
||||
write-output "no deploy in there"
|
||||
$Jira_number = "DEPLOY-$Jira_number"
|
||||
}
|
||||
write-verbose $Jira_number
|
||||
$url = "https://prometheusgroup.atlassian.net/browse/$Jira_number"
|
||||
|
||||
Start-Process $url
|
||||
|
||||
|
||||
Start-Sleep -Seconds 10
|
||||
@@ -0,0 +1,57 @@
|
||||
$VerbosePreference = "continue"
|
||||
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$form = New-Object System.Windows.Forms.Form
|
||||
$form.Text = 'Jira task'
|
||||
$form.Size = New-Object System.Drawing.Size(300,200)
|
||||
$form.StartPosition = 'CenterScreen'
|
||||
|
||||
$okButton = New-Object System.Windows.Forms.Button
|
||||
$okButton.Location = New-Object System.Drawing.Point(75,120)
|
||||
$okButton.Size = New-Object System.Drawing.Size(75,23)
|
||||
$okButton.Text = 'OK'
|
||||
$okButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
|
||||
$form.AcceptButton = $okButton
|
||||
$form.Controls.Add($okButton)
|
||||
|
||||
$cancelButton = New-Object System.Windows.Forms.Button
|
||||
$cancelButton.Location = New-Object System.Drawing.Point(150,120)
|
||||
$cancelButton.Size = New-Object System.Drawing.Size(75,23)
|
||||
$cancelButton.Text = 'Cancel'
|
||||
$cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
|
||||
$form.CancelButton = $cancelButton
|
||||
$form.Controls.Add($cancelButton)
|
||||
|
||||
$label = New-Object System.Windows.Forms.Label
|
||||
$label.Location = New-Object System.Drawing.Point(10,20)
|
||||
$label.Size = New-Object System.Drawing.Size(280,20)
|
||||
$label.Text = 'Please enter the Jira task number:'
|
||||
$form.Controls.Add($label)
|
||||
|
||||
$textBox = New-Object System.Windows.Forms.TextBox
|
||||
$textBox.Location = New-Object System.Drawing.Point(10,40)
|
||||
$textBox.Size = New-Object System.Drawing.Size(260,20)
|
||||
$form.Controls.Add($textBox)
|
||||
|
||||
$form.Topmost = $true
|
||||
|
||||
$form.Add_Shown({$textBox.Select()})
|
||||
$result = $form.ShowDialog()
|
||||
|
||||
if ($result -eq [System.Windows.Forms.DialogResult]::OK)
|
||||
{
|
||||
$Jira_number = $textBox.Text
|
||||
|
||||
if(-Not($Jira_number -like "DEPLOY*")){
|
||||
Write-Verbose $Jira_number
|
||||
write-verbose "no deploy in there"
|
||||
$Jira_number = "DEPLOY-$Jira_number"
|
||||
}
|
||||
write-verbose $Jira_number
|
||||
$url = "https://prometheusgroup.atlassian.net/browse/$Jira_number"
|
||||
|
||||
Start-Process $url
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
#########################################################################################
|
||||
#
|
||||
# Ownership taker
|
||||
#
|
||||
#########################################################################################
|
||||
# this script can be use to take the ownership of an account
|
||||
# specify your name in the list of $list_of_known_users with your autologonname (put your login name if you don't know your Pbkdf2 Hash)
|
||||
# and put the name of your object in the variable $own_user_objectName
|
||||
# then execute the script, specifiy the targeted user and the targeted database(s)
|
||||
# if you want to revert back the configuration, replace the variable $own_user_objectName with the name of the object of the person you took the ownership
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
# Database Value
|
||||
#
|
||||
#########################################################################################
|
||||
|
||||
|
||||
|
||||
#other
|
||||
#$DBInstance = 'DB NAME'#
|
||||
|
||||
|
||||
#$DBACredential = Get-Credential -UserName pgadmin -Message "Credentials for $DBInstance"
|
||||
#DBPassword = $DBACredential.GetNetworkCredential().Password
|
||||
#$DBUsername = $DBACredential.UserName
|
||||
|
||||
|
||||
#Database=$database
|
||||
$ConnectionString = "Server=$DBInstance;User Id=$DBUsername;Password=$DBPassword;TrustServerCertificate=True"
|
||||
$VerbosePreference = 'Continue'
|
||||
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
# User value
|
||||
#
|
||||
#########################################################################################
|
||||
|
||||
$list_of_known_users = [ordered]@{
|
||||
Admin = [PSCustomObject]@{
|
||||
"Name"="Admin"
|
||||
"username"="admin"
|
||||
"autologonname"=""
|
||||
};
|
||||
Administrator = [PSCustomObject]@{
|
||||
"Name"="Administrator"
|
||||
"username"="administrator"
|
||||
"autologonname"=""
|
||||
};
|
||||
Anastasia = [PSCustomObject]@{
|
||||
"Name"="Anastasia"
|
||||
"username"="akroupkina"
|
||||
"autologonname"=""
|
||||
};
|
||||
Henry = [PSCustomObject]@{
|
||||
"Name"="Henry"
|
||||
"username"="hchung"
|
||||
"autologonname"=""
|
||||
};
|
||||
Frans = [PSCustomObject]@{
|
||||
"Name"="Frans"
|
||||
"username"="frans"
|
||||
"autologonname"=""
|
||||
};
|
||||
Blake = [PSCustomObject]@{
|
||||
"Name"="Blake"
|
||||
"username"="bparrish"
|
||||
"autologonname"=""
|
||||
};
|
||||
Besfort = [PSCustomObject]@{
|
||||
"Name"="Besfort"
|
||||
"username"="bhyseni"
|
||||
"autologonname"=""
|
||||
};
|
||||
Kyle = [PSCustomObject]@{
|
||||
"Name"="Kyle"
|
||||
"username"="kpatel"
|
||||
"autologonname"=""
|
||||
};
|
||||
Pierre = [PSCustomObject]@{
|
||||
"Name"="Pierre"
|
||||
"username"="pierretotal"
|
||||
"autologonname"=""
|
||||
}
|
||||
}
|
||||
|
||||
#########################################################################################
|
||||
# Fill with your user object name
|
||||
#########################################################################################
|
||||
$own_user_objectName = 'Pierre'
|
||||
|
||||
$ownAutologonname = $list_of_known_users.$own_user_objectName.autologonname
|
||||
|
||||
|
||||
#get the target
|
||||
$targetObjectName = $list_of_known_users.keys |Out-GridView -PassThru -Title "Select the target"
|
||||
|
||||
$targetName = $list_of_known_users.$targetObjectName.Name
|
||||
$targetUserName = $list_of_known_users.$targetObjectName.Username
|
||||
|
||||
Write-output "You selected the user $targetName to take ownership "
|
||||
|
||||
$QuerySelectDatabases= "SELECT name FROM sys.databases order by name"
|
||||
$targeted_DB= Invoke-Sqlcmd -ConnectionString $ConnectionString -Query $QuerySelectDatabases |Out-GridView -PassThru -Title "Select the targeted databases"
|
||||
|
||||
|
||||
foreach( $database in $targeted_DB ) {
|
||||
$DB_name = $database.Name
|
||||
write-output "updating $DB_name"
|
||||
|
||||
|
||||
|
||||
$queryVerifyPresenceUser = "
|
||||
SELECT
|
||||
CASE WHEN EXISTS
|
||||
(
|
||||
select pk_userid,username, createcomputer , firstname, lastname , autologonname, isactive from $DB_name.dbo.tblUser where username = '$targetUserName'
|
||||
)
|
||||
THEN 'TRUE'
|
||||
ELSE 'FALSE'
|
||||
END
|
||||
"
|
||||
write-output $queryVerifyPresenceUser
|
||||
$boolean_presence_users = Invoke-Sqlcmd -ConnectionString $ConnectionString -Query $queryVerifyPresenceUser
|
||||
write-verbose $boolean_presence_users.Column1
|
||||
if($boolean_presence_users.Column1 -eq "FALSE"){
|
||||
write-output "the user doesn't exist in the following database : $DB_name"
|
||||
continue
|
||||
}
|
||||
|
||||
$QueryUpdatingUser= "
|
||||
update $DB_name.dbo.tblUser
|
||||
set isactive = 1,
|
||||
autologonname = '$ownAutologonname'
|
||||
where username = '$targetUserName';
|
||||
"
|
||||
Write-Output "Query to execute :"
|
||||
Write-Output $QueryUpdatingUser
|
||||
Write-Warning "Are you sure to proceed ?" -WarningAction Inquire
|
||||
Invoke-Sqlcmd -ConnectionString $ConnectionString -Query $QueryUpdatingUser
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Delete the specific object with the following parameters
|
||||
|
||||
.Parameter -path
|
||||
path of the folder to look for the files ,this is MANDATORY
|
||||
|
||||
.Parameter -retention_number_of_day
|
||||
Value for the number of day the files needs to be older to be deleted, this is MANDATORY
|
||||
|
||||
.Parameter -pattern_to_delete
|
||||
Pattern to target if you need to delete a specific extension or pattern within the filename, this is OPTIONAL
|
||||
if you want to specify only the filename put it without any sign
|
||||
Example : -pattern_to_delete "catalina"
|
||||
|
||||
if you want to target extension name specify the dot
|
||||
Example : -pattern_to_delete ".log"
|
||||
|
||||
If you want to specify a specific filename and an extension, just add the * between the word
|
||||
Example : -pattern_to_delete "catalina*.log"
|
||||
|
||||
.Parameter -recurse_boolean
|
||||
option to search recursively or not, this is OPTIONAL , DEFAULT = $false
|
||||
|
||||
.Parameter -dry_run_boolean
|
||||
option to perform dry run and display what would be deleted this is OPTIONAL , DEFAULT = $false
|
||||
|
||||
.Example
|
||||
# delete all the log files within the C:\Users\USER\Documents directory for the files older than 30 days with the name log within their name or extension
|
||||
deletion_of_specific_objects -path "C:\Users\USER\Documents" -retention_number_of_day 30 -pattern_to_delete "log"
|
||||
|
||||
# delete all the files within the C:\Users\USER\Documents directory for all the files within all the folder
|
||||
deletion_of_specific_objects -path "C:\Users\USER\Documents" -retention_number_of_day 0 -recurse_boolean $true
|
||||
|
||||
#>
|
||||
|
||||
function deletion_of_specific_objects{
|
||||
param(
|
||||
[Parameter (Mandatory = $true)] [String]$path,
|
||||
[Parameter (Mandatory = $false)] [String]$pattern_to_delete,
|
||||
[Parameter (Mandatory = $true)] [Int]$retention_number_of_day,
|
||||
[Parameter (Mandatory = $false)] [boolean]$recurse_boolean = $false,
|
||||
[Parameter (Mandatory = $false)] [boolean]$dry_run_boolean = $false
|
||||
)
|
||||
$recurse_boolean_parameter = @{Recurse = $recurse_boolean}
|
||||
$Dry_run = @{Whatif = $dry_run_boolean}
|
||||
|
||||
Get-ChildItem -Path $path/* -File -Include *$pattern_to_delete* @recurse_boolean_parameter |Where CreationTime -lt (Get-Date).AddDays(-$retention_number_of_day)|Remove-Item @Dry_run
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
|
||||
deletion_of_specific_objects -path "C:\Users\USER\Documents" -retention_number_of_day 30 -pattern_to_delete "*.log" -recurse_boolean $true -dry_run_boolean $false
|
||||
@@ -0,0 +1,32 @@
|
||||
$VerbosePreference='continue'
|
||||
|
||||
|
||||
|
||||
$Server= 'tot-ctx-prd02'
|
||||
|
||||
$Profiles = Get-ChildItem -Directory \\$Server\c$\users | Select-Object -ExpandProperty name
|
||||
|
||||
$OU='OU=User Accounts,OU=roser-total,DC=roser-total,DC=local'
|
||||
$ADusers= Get-ADuser -filter * -SearchBase $OU | Where-Object { $Profiles -ccontains $psitem.samaccountname }
|
||||
|
||||
|
||||
|
||||
|
||||
Get-ADComputer -filter "name -like '$Server'" | ForEach-Object {
|
||||
|
||||
Write-Verbose $psitem.DNSHostname
|
||||
|
||||
Invoke-Command -ComputerName $psitem.DNSHostname -ScriptBlock { $VerbosePreference='continue';
|
||||
|
||||
|
||||
|
||||
foreach($sid in $args) {
|
||||
|
||||
Write-Verbose $SID
|
||||
Get-WMIObject -class Win32_UserProfile -Filter "SID='$sid'" | Remove-WmiObject -Verbose
|
||||
|
||||
}
|
||||
|
||||
} -ArgumentList ($ADusers).SID
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
$VerbosePreference = "continue"
|
||||
Start-Transcript C:\Users\pgeeraert_a\Desktop\DEPLOY-27258\Attachements\transcripts_copy.txt
|
||||
|
||||
copy-item \\roser-bp.local\shares\RoserBPFiles\whiting\97055c44-7b7a-4cac-9196-e7a63b838cd8.pdf C:\Users\pgeeraert_a\Desktop\DEPLOY-27258\Attachements
|
||||
|
||||
Stop-Transcript
|
||||
Reference in New Issue
Block a user