I hereby claim:
- I am davops on github.
- I am adminator (https://keybase.io/adminator) on keybase.
- I have a public key ASB-a6og_L_IAehBFXhOvx-i-vZaA4BNe4uM0yfO9tEs9wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
$dnsServer = "Server1.domain.com" | |
([System.Net.Dns]::GetHostAddresses($dnsServer) | where {$_.AddressFamily -eq 'InterNetwork'}).IPaddressToString |
$serverName = "SQL1" ###name of the SQL instance, not the server name | |
$jobQuery = "select jobs.name from msdb.dbo.sysjobs jobs (nolock) | |
join msdb.dbo.syscategories categories (nolock) | |
on jobs.category_id = categories.category_id | |
where jobs.name like '$servername-YourReplicationName%' AND categories.name = 'REPL-Merge'"###Used for merge replication but can be changed | |
$jobQuery = (Invoke-Sqlcmd -ServerInstance $serverName -Query $jobQuery | Select-Object -Property name).name | |
$jobQuery | Out-File c:\logs\database\replication__sync_log.txt -Append | |
foreach ($row in $jobQuery) | |
{ |
<# | |
.NOTES | |
Name: Get-CertSettings.ps1 | |
Author: Davina Fournier | |
Requires: PowerShell v3 or higher. The account running this script needs to have rights to access IIS settings on the target servers. Tested on 2012 servers in a single domain. | |
Last Updated: 7/31/2016 | |
.SYNOPSIS | |
Retrieves all websites from IIS. Prints the hostname of the target server, the website name, whether or not SSL is enabled, the certificate expiration date, the certificate subject and the certificate subject alternative names (for multi-domain certificates). | |
.DESCRIPTION | |
A list of remote computer names should be entered into the Server_list.txt file currently located in the "Tools\Scripts" directory. The script creates a session to each remote computer, then queries IIS for the binding settings of each website. If the website has no SSL binding, then the "SSL Enabled" setting will be set to "Not Enabled" and the remaining values will be empty. If there is a SSL binding, the Local Machine stores are searched for the corresponding certif |
#Purpose: Start background jobs on multiple servers at the same time and wait until they finish | |
$servers = "server1","server2","server3" | |
$buildNumber = "1.2" | |
$servers | %{ | |
$script = | |
{ | |
param($server) | |
Invoke-Command -ComputerName $server -ScriptBlock {param($buildNumber) New-Item c:\Deployment\$buildNumber -type directory -force} |
#Deleting Sites and app pools in IIS 7 with PowerShell | |
$appCmd = "C:\windows\system32\inetsrv\appcmd.exe" | |
#lists all the sites | |
& $appcmd list site | |
#deletes a specific site | |
& $appcmd delete site "Name of site" | |
#deletes a specific application pool | |
& $appcmd delete apppool "Name of app pool" | |
#delete any app pools that use a certain username (in the identity column of the GUI) |
$thisPsSession = New-PSSession SERVER1 | |
Invoke-Command -Session $thisPsSession -ScriptBlock { | |
Set-ExecutionPolicy RemoteSigned | |
} |
--Find a prexisting email profile to be inserted into the "@profile_name" variable below | |
EXEC msdb.dbo.sysmail_help_profile_sp; | |
--Define the text you will email | |
DECLARE @body NVARCHAR(MAX) | |
SET @body = 'Whatever you want to send yourself' | |
--Send the email using the email profile found | |
EXEC msdb.dbo.sp_send_dbmail | |
@profile_name = 'Administrator Profile', | |
@recipients = '[email protected]', | |
@body = @body, |
$thisPsSession = New-PSSession "Server1" | |
Invoke-Command -Session $thisPsSession -ScriptBlock { | |
sqlcmd.exe -q "SELECT yourcolumn FROM yourdatabase" | |
} | |
Remove-PSSession $thisPsSession |
EXEC sp_MSForEachDB ' Use [?]; SELECT DB_NAME() AS ''Database Name''; | |
Select * | |
FROM sys.sql_modules m | |
INNER JOIN sys.objects o ON m.object_id=o.object_id | |
INNER JOIN sys.schemas s ON o.schema_id=s.schema_id | |
WHERE m.definition Like ''%xp_cmdshell%'' | |
ORDER BY 1' |