This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -- Get the full script here : https://github.com/VimalShekar/PowerShell/blob/master/CheckIsUserValid_1.ps1 | |
function IsLocalUserNamePasswordValid() | |
{ | |
param( | |
[String]$UserName, | |
[String]$Password | |
) | |
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('machine',$ComputerName) | |
$bReturn = $DS.ValidateCredentials($UserName, $Password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -- Get the full script here : https://github.com/VimalShekar/PowerShell/blob/master/CheckIsUserValid.ps1 | |
# This is used by some of the functions below | |
$logonUserSignature = | |
@' | |
[DllImport( "advapi32.dll" )] | |
public static extern bool LogonUser( String lpszUserName, | |
String lpszDomain, | |
String lpszPassword, | |
int dwLogonType, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-- Get the full script here:https://github.com/VimalShekar/PowerShell/blob/master/CheckDotNet.ps1 | |
Function IsDotNet35orGreater { | |
# Check if .NET version 3.5 or greater is present | |
[bool] $bVersionPresent = $false | |
$Frameworks = Get-ChildItem "HKLM:\Software\Microsoft\NET Framework Setup\NDP" | |
foreach($FWver in $Frameworks) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-- Get the full script here:https://github.com/VimalShekar/PowerShell/blob/master/CheckDotNet.ps1 | |
Function IsDotNet2orGreater { | |
# Check if .NET version 2.0 or greater is present | |
[bool] $bVersionPresent = $false | |
$Frameworks = Get-ChildItem "HKLM:\Software\Microsoft\NET Framework Setup\NDP" | |
foreach($FWver in $Frameworks) { | |
# if it matches v[0-9].+ and is >= v2.0 then requisite is met |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-- Get the full script here : https://github.com/VimalShekar/PowerShell/blob/master/GetCredmanCreds.ps1 | |
# | |
# Function to read the IE/Edge password vault (Web Credentials portion of credential manager) | |
# | |
function Get-PasswordVaultCredentials { | |
#initilize empty array | |
$CRED_MANAGER_CREDS_LST = @() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adding as GIST, to make it easier to link to my blog. | |
# Visit: vimalshekar.ml for more interesting scripts. | |
# | |
# If given GPO is linked to any OU, it deletes the links and then attempts to delete the GPO. | |
# | |
function Delete-GPOByName | |
{ | |
param( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-- For full script, refer: https://github.com/VimalShekar/PowerShell/blob/master/GetCredmanCreds.ps1 | |
# This script uses CredEnum Windows API, to retrieve stored usernames and passwords from Windows credential manager. | |
# | |
# Function to compile C Sharp code into an assembly | |
# | |
function Compile-Csharp () | |
{ | |
param( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WinRM only works on Private and Domain networks, it is disabled on public networks. | |
# Detect and modify any networks which are set to Public, ensure that every network is private. | |
# First, set CategoryType to 1 under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles | |
# Then create an instance of {DCB00C01-570F-4A9B-8D69-199FDBA5723B}, get connections and set the category! | |
function Enable-WinRMOnWorkGroupMachine { | |
$Private:ConnectionProfiles = Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles' | |
foreach ($ConnProf in $Private:ConnectionProfiles) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TcpSendRecv() | |
{ | |
param( | |
[int] $Port = 5005, | |
$IP = "127.0.0.1" , | |
$Message = "TRUN ." + "A"*6000 +". " | |
) | |
$Address = [system.net.IPAddress]::Parse($IP) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# If given GPO is linked to any OU, it deletes the links and then attempts to delete the GPO. | |
# | |
function Delete-GPOByName | |
{ | |
param( | |
[string]$GPOName, | |
[string]$DomainName | |
) | |
OlderNewer