I had a customer where new DNS servers was setup (that was - new DCs with AD integrated DNS). To change DNS server settings on the Nic, facing the produktion network, on all servers in the domain, I wrote this script.
Using RootDse, no domain name is hardcoded.
The script checks the AD for servers,
then it check all NICs on the server to see if there is DNS settings matching the ip's given in strings strODNS1 and strODNS2.
If a match is found, the DNS settings are changed to the ip's given in strNDNS1 and strNDNS2.
Same is done regarding WINS settings.
A logfile - DNS.TXT - are created, listing servernames and changes made.
-------------------------------------------------------------------------------
'Change DNS and WINS on NICs
'
On Error Resume Next
'Old settings
strODNS1="192.168.1.19"
strODNS2="192.168.1.10"
strOWins1="192.168.1.19"
strOWins2="192.168.1.10"
'New settings
strNDNS1="192.168.1.19"
strNDNS2="192.168.1.100"
strNWins1="192.168.1.19"
strNWins2="192.168.1.100"
Const ADS_SCOPE_SUBTREE = 2
Const strLogFile = "DNS.TXT"
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
'Delete log file if it exists
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(strLogFile) then
fso.DeleteFile strLogFile
end if
WriteLog "Started: " & date
WriteLog " "
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
Set RootDse = GetObject( "LDAP://RootDse" )
strADSPath = "LDAP://" & RootDse.get( "DefaultNamingContext" )
objCommand.CommandText = "Select Name,operatingSystem from '" & strADSPath & "' Where objectClass='computer' and OperatingSystem='*server*'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
objServer = objRecordSet.Fields("Name").Value
wscript.echo "Checkin server: " & objServer
WriteLog "Checking server: " & objServer
'objOS = objRecordset.Fields("OperatingSystem").value
'wscript.echo objOS
strComputer = objServer
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objAdapter in colAdapters
If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
'WScript.Echo " IP address: " & objAdapter.IPAddress(i)
'WriteLog " IP: " & objAdapter.IPAddress(i)
Next
End If
If Not IsNull(objAdapter.DNSServerSearchOrder) Then
For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
'WScript.Echo " DNS " & objAdapter.DNSServerSearchOrder(i)
'WriteLog " DNS " & objAdapter.DNSServerSearchOrder(i)
if (objAdapter.DNSServerSearchOrder(i) = strODNS1) or (objAdapter.DNSServerSearchOrder(i) = strODNS2) then
writeLog " - dns settings changed ..."
objAdapter.SetDNSServerSearchOrder Array (strNDNS1,strNDNS2)
end if
Next
End If
'WriteLog " WINS1: " & objAdapter.WINSPrimaryServer
'WriteLog " WINS2: " & objAdapter.WINSSecondaryServer
if (objAdapter.WINSPrimaryServer = strOWins1) or (objAdapter.WINSPrimaryServer = strOWins2) then
objAdapter.SetWINSServer strNWins1,strNWins2
WriteLog " - WINS settings are changed..."
end if
Next
WriteLog " "
objRecordSet.MoveNext
Loop
Function WriteLog(aStr)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(strLogFile, ForAppending, True)
f.WriteLine aStr
f.Close
Set f = Nothing
Set fso = Nothing
End Function
11 May 2010
05 May 2010
Remote scripting on Windows Server 2008
If you leave the windows firewall turned on on your Windows Server 2008 boxes, you are not allowed to run script against a remote server.
The windows firewall will block these attemps.
Running in a domain, the fastest way to allow remote script execution, is to create a group policy...
Create a new GPO and drill to:
Computer Configuration -> Policies -> Administrative Templates -> Network -> Network Connections -> Windows Firewall -> Domain Profile
Set "Windows Firewall: Allow inbound remote administration exception" to "Enabled"
- and configure with a specific ip address (if only one machine is allowed for remote scripting)or a subnet (the subnet from where the remote script will be fired).
The windows firewall will block these attemps.
Running in a domain, the fastest way to allow remote script execution, is to create a group policy...
Create a new GPO and drill to:
Computer Configuration -> Policies -> Administrative Templates -> Network -> Network Connections -> Windows Firewall -> Domain Profile
Set "Windows Firewall: Allow inbound remote administration exception" to "Enabled"
- and configure with a specific ip address (if only one machine is allowed for remote scripting)or a subnet (the subnet from where the remote script will be fired).
29 April 2010
WINS - access denied to wins server in wins mmc
And just as we thought wins was dead.....
it comes right back and keeps hunting you.
The case:
I had to install the WINS service on a DC.
No problem - easy and fast done..
BUT... when starting the WINS mmc... ACCESS DENIED to the wins server !!!!
well... the solution
edit permissions on reg-key HKEY_LOCAL_MACHINE\SYSTEM\CurentControlSet\Control\SecurePipeServers\winreg
"LOCAL SERVICE" needs to be added with Read permissions.
Then it worked.....
it comes right back and keeps hunting you.
The case:
I had to install the WINS service on a DC.
No problem - easy and fast done..
BUT... when starting the WINS mmc... ACCESS DENIED to the wins server !!!!
well... the solution
edit permissions on reg-key HKEY_LOCAL_MACHINE\SYSTEM\CurentControlSet\Control\SecurePipeServers\winreg
"LOCAL SERVICE" needs to be added with Read permissions.
Then it worked.....
WII - SoftMod
I've softmod'ed my WII
- it works so great :-)
All games are now running from an external USB harddrive,
and in the menu, I just go through all the covers to find the game I want to play.
And it is so easy to do
the guidence make it so easy,
it guides you through the setup and download/use of programs
Find it here:
http://wiinyt.dk/forum/discussion/1877/1/softmod-42-guide-v9/
I have moved my channels a little around, so that Wii-Flow (the usb-loader I use)
so that I easyli have access to my games.
- it works so great :-)
All games are now running from an external USB harddrive,
and in the menu, I just go through all the covers to find the game I want to play.
And it is so easy to do
the guidence make it so easy,
it guides you through the setup and download/use of programs
Find it here:
http://wiinyt.dk/forum/discussion/1877/1/softmod-42-guide-v9/
I have moved my channels a little around, so that Wii-Flow (the usb-loader I use)
so that I easyli have access to my games.
Starting SCOM console with cache cleared
Fire the following command to launch SCOM Console UI with a cleared cache:
Run: "C:\Program Files\System Center Operations Manager 2007\Microsoft.mom.ui.console.exe" /ClearCache
Run: "C:\Program Files\System Center Operations Manager 2007\Microsoft.mom.ui.console.exe" /ClearCache
Service Broker alerts
How to check if the Service Broker is enabled
- and how to enable if not...
Log on to SQL and execute query: SELECT is_broker_enabled FROM sys.databases WHERE name=’OperationsManager’
If it returns 1, don’t read any further, if not:
Execute: ALTER DATABASE OperationsManager SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Execute: ALTER DATABASE OperationsManager SET ENABLE_BROKER
Execute: ALTER DATABASE OperationsManager SET MULTI_USER
Restart OpsMgr SDK Service
- and how to enable if not...
Log on to SQL and execute query: SELECT is_broker_enabled FROM sys.databases WHERE name=’OperationsManager’
If it returns 1, don’t read any further, if not:
Execute: ALTER DATABASE OperationsManager SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Execute: ALTER DATABASE OperationsManager SET ENABLE_BROKER
Execute: ALTER DATABASE OperationsManager SET MULTI_USER
Restart OpsMgr SDK Service
Logs on CrossPlatform agent installation
When instaling CrossPlatform SCOM agents, default no logs are created to help troubleshooting.
Using this litlle trick, SCOM will generate these logs
In the Windows\Temp folder create following file: EnableOpsMgrModuleLogging
After this file is created, SCOM will generate logfiles in the Windows\Temp folder when installing CrossPlatform agents.
To stop these logfiles, delete the EnableOpsMgrModuleLogging-file.
Using this litlle trick, SCOM will generate these logs
In the Windows\Temp folder create following file: EnableOpsMgrModuleLogging
After this file is created, SCOM will generate logfiles in the Windows\Temp folder when installing CrossPlatform agents.
To stop these logfiles, delete the EnableOpsMgrModuleLogging-file.
Subscribe to:
Posts (Atom)