Hi powershell,
am very new to powershell scripting,as a windows adminstrator.
i want to disable the NIC cards of a partilcuar server.The server list listed on a one notepad,
we can read the server name from notepad,then what ever the servers listed the particlur server nic will disabled.
here really i dont have idea regarding how to disbale the nic of specified server on a cluster.
one of my peermate told to me....each server have 1 to 3 nic configued on server.
Thanks for any information you can provide.. I respect your powershell forum opinion as I have watched you help so many folks on the web.
I also have your forums which have help me a great deal.
Thanks in advance..
Srkrish
A few questions - do you want to disable all NICs on the server or just some of them?
A cluster could have a number of NICs for each server - public, private and management networks fro instance. If you disable the NICs on a server in a cluster the cluster won't work properly. What are you trying to achieve by disabling the NICs
Am very happy to see the reply..Thank you..RSiddaway..
just i want to disable the NICs in a particular server .the servers list listed on a notepad..
i have below code ,please colud you help me,how i can run, this....code....thanks in advance..
your ask me about wht achieve ....be frankly ...am a very new to windows admin side....my manager told to me this.......
am fighting to crack this NIC disable in server level....please let me out.....Thanks in advance,...
*************************************************************
$computername = Get-Content 'list.txt'
ForEach ($Computer in $computername) {
Try {
$Index = Get-WmiObject -Computername $computer win32_networkadapterconfiguration -Filter "IPEnabled='True'" -EA Stop | Select -expand Index
Get-Wmiobject -Computer computer Win32_NetworkAdapter -Filter "Index !='$index'" -EA Stop | ForEach {
$nic = $_
Write-Host ("{0}: Disabling" -f $nic.Name)
Switch ($nic.Disable()) {
0 {Write-Host ("{0}: Succesfully disabled!" -f $nic.Name) -Fore Green -Back Black}
Default {Write-Warning ("{0}: Something happened! Return Value: {1}" -f $nic.name,$_)}
}
} Catch {
Write-Warning ("{0}: {1}" -f $Computer, $_.Exception.Message)
hi siddaway,
RPC errors = the machine you are trying to connect to does not answer, either because it is not online, or because a firewall blocks access.