Skip to content

Instantly share code, notes, and snippets.

View shinish's full-sized avatar

Shinish Sasidharan shinish

View GitHub Profile
<#
.Synopsis
Find Account Lockout Source
.DESCRIPTION
Find Account Lockout Source
.NOTE
TechieShinish
.LINK
https://techieshinish.com/hyperv-health-report/
#>
<#
.Synopsis
Find Account Lockout Source
.DESCRIPTION
Find Account Lockout Source
.NOTE
TechieShinish
.LINK
https://techieshinish.com/find-account-lockout-source/
#>
<#
.Synopsis
Sign-off Disconnected Users from Local Machine
.DESCRIPTION
Sign-off Disconnected Users from Local Machine, Buffer time is set for 3 Hours. Users Disconnected 3 hours back will be Signed out.
.EXAMPLE
.\Remove-DiconnectedUsers
.EXAMPLE
.\Remove-DiconnectedUsers -Logfile "c:\Logs\DisconnectedUserLogs"
#>
@shinish
shinish / Install-Webserver.ps1
Last active November 18, 2022 08:47
Learn to Install IIS server using Windows PowerShell from scratch
# Title : Installing Windows Feature - IIS (WebServer) using PowerShell
# -By Shinish.S
$IsInstalled = ((Get-WindowsFeature -Name Web-Server).installed)
if ($isinstalled -eq $false){
Install-WindowsFeature Web-Server -IncludeManagementTools -IncludeAllSubFeature -Confirm:$false
Write-Output "Installation Complete"
}
else{
Write-output "IIS Server (WebServer) is already installed"
}
@shinish
shinish / Delete-OldAccouts.ps1
Created December 11, 2018 20:31
Remove the Deleted object from the SMB Share
#Declarations
$testPath = 'C:\Scripts'
$csvInputFile = 'C:\Scripts\inputFile.csv'
$OutFilePath = 'C:\Scripts\csvOutFileSample.csv'
$inputFile = Import-Csv -Path $csvInputFile
#Variables
$VerbosePreference = 'Continue'
#function starts here
#Declarations
$testPath = 'd:\Script'
$csvInputFile = 'D:\Script\Input.csv'
$OutFilePath = 'd:\Script\SID_Removal_Report.csv'
$inputFile = Import-Csv -Path $csvInputFile
$counter = 0
$Results = @()
if (Test-Path $OutFilePath){
Remove-Item $OutFilePath -Force
New-item $OutFilePath -ItemType File | out-null
$VerbosePreference = "Continue"
$Computers = Get-Content "c:\scripts\Serverlist.txt"
foreach ($ComputerName in $Computers){
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
if (Test-Path 'C:\windows\CCM'){
Write-Output "$env:ComputerName : Script is Running"
get-service ccmexec -ea SilentlyContinue |
Stop-Service -Force -Verbose
Remove-Item -Path "$($Env:WinDir)\CCM" -Force -Confirm:$false -Verbose
Remove-Item -Path "$($Env:WinDir)\CCMSetup" -Force -Confirm:$false -Verbose
@shinish
shinish / Get-NICInfo.Ps1
Created September 8, 2018 01:59
Get the NIC Teaming Information for all the Domain Controllers accross the Forest. Requires PowerShell version 4.0 and above
#Requires –Version 4
$Params = @{
head = @"
<Title>NIC Teaming Report -www.PowerShellHacks.com</Title>
<style>
body { background-color:#dbdad9;
font-family:Verdana;
font-size:10pt; }
td, th { border:0px solid black;
border-collapse:collapse;
@shinish
shinish / Report-ComputerReboot.ps1
Last active September 2, 2018 01:41
This script is for checking the Computers in the entire Infrastructure that are not rebooted in the past 30 days
$Computers = (Get-ADComputer -Filter *).name
$Hashreport = @()
$HashObject = @()
$Prereport = @()
$Lastboottime = (get-date).AddDays(-30)
$Dir = 'C:\Scripts'
$logs = "C:\scripts\logs\ScriptRebootTracker.txt"
$csv = 'C:\scripts\Repo\ReportRebootTracker.csv'
$Exppath = 'C:\Scripts\Repo'
$Logpath = 'C:\Scripts\Logs'
$Computers = (Get-ADComputer -Filter *).name
$Hashreport = @()
$HashObject = @()
$Prereport = @()
$Lastboottime = (get-date).AddDays(-30)
$Dir = 'C:\Scripts'
$logs = "C:\scripts\logs\ScriptRebootTracker.txt"
$csv = 'C:\scripts\Repo\ReportRebootTracker.csv'
$Exppath = 'C:\Scripts\Repo'
$Logpath = 'C:\Scripts\Logs'