Posted On March 29, 2019

PowerShell: Disable NetBios

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Disable NetBios
# Set Credentials
$username = "KIMCONNECT\"+(Read-Host -Prompt 'Input the Admin Username: ')
$password = Read-Host -Prompt "Input the password for account $username"
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$pass 

$computers="SERVER1"

foreach ($computer in $computers){
Invoke-Command -ComputerName $computer -Credential $cred -ScriptBlock {

$adapters=(Get-WmiObject Win32_NetworkAdapterConfiguration)
# $adapters=(Get-WmiObject Win32_NetworkAdapterConfiguration | Where Description -like "*Ethernet*")
Foreach ($adapter in $adapters){
  Write-Host $adapter
  $adapter.settcpipnetbios(0)
    };

}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

WordPress Code Snippet Crashed My Site

Error Message: ParseError thrown syntax error, unexpected '$', expecting variable (T_VARIABLE) Resolution:1. If still login…

PowerShell: Install Windows Exporter

Simple Version $windowsExporterUrl='https://github.com/prometheus-community/windows_exporter/releases/download/v0.20.0/windows_exporter-0.20.0-amd64.msi' $stageFolder='C:\Temp\' # Download the file Import-Module BitsTransfer $fileName=[regex]::match($windowsExporterUrl,'[^/\\&\?]+\.\w{3,4}(?=([\?&].*$|$))') $msiFile=join-path $stageFolder $fileName if(!(test-path…

Add Local Windows User

# Dynamic Credential$who = whoamiif ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;}else {$username=$who+"-admin";}$password = Read-Host -Prompt "Input the…