alter table table_name
add RowID int identity(1,1)
Author Archives: Henrik
SMTP search Windows 7
Ping with timestamp for Windows
VMware check for VAAI on storage
Connect to a ESX host with SSH.
Run command
esxcli storage core device vaai status get
Find AD FSMO via CMD
netdom query /domain:dom.local fsmo
Powershell mail all files from directory and move them
Get-ChildItem “C:\FilePorts\ValidationPDFs\*” -include *.pdf | foreach { Send-MailMessage -from “from@mail.com” -to “to@mail.com” -subject $_.name -attachments $_.fullname -smtpServer mail.server }
Get-ChildItem “C:\FilePorts\ValidationPDFs\*” -include *.pdf | move-item -destination “C:\FilePorts\ValidationPDFs\printet”
Powershell delete Paused – Spooling print jobs
Deletes Paused – Spooling print jobs that are older than 12 hours
$PrintJobs = get-wmiobject -class "Win32_PrintJob" -namespace “root\CIMV2” -computername . | Where-Object { $_.JobStatus -eq "Paused | Spooling" -and [System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeSubmitted) -lt $($(Get-Date).addHours(-12))}
foreach ($job in $PrintJobs)
{
Write-Host “Canceling job $($job.JobId)”
Write-Host “Document: $($job.Document)”
Write-Host “Owner: $($job.Owner)”
$job.Delete() }
Plugin for Firefox to download all files on webpage
Powershell script, get locked account from multiple Windows 2008 servers
Param(
[Parameter(Mandatory=$True)]
[string]$Username,
[Parameter(Mandatory=$False)]
[array]$Computers=@(“ad-server1”, “ad-server2”)
)
$Date = [DateTime]::Now.AddDays(-2)
Get-EventLog “Security” -after $Date -computer $Computers | Where-Object { $_.InstanceID -eq 4740 -or $_.InstanceID -eq 4625} | ? { $_.message -match $Username} | fl TimeGenerated, Message
