Freitag, 7. Oktober 2011

How to allow root user ssh access

How to grant root User SSH Access

cmd-line:


sed -e 's/PermitRootLogin no/PermitRootLogin yes/' -i /etc/ssh/sshd_config
/sbin/service sshd reload

This allowes SSH Access for the user "root".

Lancom Commands

trace + all schaltet alle Trace-Ausgaben ein
trace - all schaltet alle Trace-Ausgaben aus
trace + protocol display schaltet die Ausgabe aller
Verrbindungsprotokolle und der Status- und
Fehlermeldungen ein

trace + all - icmp
schaltet alle Trace-Ausgaben mit Ausnahme des
ICMP-Protokolls ein
trace ppp zeigt den Zustand des PPPs an
trace # ipx-rt display schaltet die Trace-Ausgaben des IPX-Routers
und der Display- Ausgaben um
trace + ip-router @ GEGENSTELLE-A GEGENSTELLE-B schaltet die Ausgaben des IP-Routers an für alle
Ausgaben, die sich auf die Gegenstellen A oder B
beziehen
trace + ip-router @ GEGENSTELLE-A
GEGENSTELLE-B -ICM
P schaltet die Ausgaben des IP-Routers an für alle
Ausgaben, die sich auf die Gegenstellen A oder B
beziehen, die nicht ICMP verwenden
trace + ip-router @ +TCP + "port: 80" schaltet die Ausgaben des IP-Routers an für alle
Ausgaben, die TCP/IP und den Port 80
verwenden. “port: 80” steht in
Anführungszeichen, um auch das Leerzeichen als
Teil der Zeichenkette einzubeziehen.
trace + vpn-status display schaltet die Ausgaben für einen VPN-Status Trace
ein. Der Parameter display liefert zusätzlich
Status- und Error-Ausgaben.

Donnerstag, 28. Januar 2010

Show LoginTime when Client logs on to Active Directory Domain

This Script will generate the following Informations automaticly:

Show LoginTime when Client logs on to Active Directory Domain, Domain Server,
Password Age, etc.




function loginmail()

$shortuser = right(@userid,len(@userid)-0)
$objEmail=CreateObject('CDO.Message')
$objEmail.From = "Benutzer_LOGIN "
$objEmail.To = "NameIT@@Domain.TLD"
$objEmail.Subject='LOGIN_Benutzer '+$shortuser+', '+$shortuser2+'. hat sich an '+@wksta+' eingeloggt'
$objEmail.Textbody='-----------[ LOGIN ]-----------------'+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Benutzer: '+@userid+''+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Workstation: '+@wksta+''+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'IP: '+@ipaddress0+''+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Uhrzeit: '+@TIME+''+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Datum: '+@DATE+''+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Logon Server: '+@LServer+''+chr(10)+chr(10)
$objEmail.Textbody=$objEmail.Textbody + '-----------[ SYSTEM INFO ]------------'+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Passwordalter: '+@PWAge+''+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Betriebssystem: '+@ProductType+''+chr(10)
$objEmail.Textbody=$objEmail.Textbody + 'Servicepack: '+@CSD+''+chr(10)
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing").value = 2
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver").value = "your_SMTP_Server"
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate").value = 1
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername").value = "LoginName_for_SMTP_Server"
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword").value = "Password_for_Authentication_to_SMTP_Server"
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport").value = 25
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl").value = False
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout").value = 60
$objEmail.Configuration.Fields.Update
$objEmail.Send
endfunction

-------------------------------------

-----------[ LOGIN ]-----------------
Benutzer: Thomas.Mann
Workstation: WorkstationName
IP: 192.192.192.192
Uhrzeit: 12:00:01
Datum: 2010/01/01
Logon Server: \\DomainControllerName01

-----------[ SYSTEM INFO ]------------
Passwordalter: 150 Days
Betriebssystem: Windows XP Professional
Servicepack: Service Pack 3

Dienstag, 26. Januar 2010

Reset Windows Server 2008 Domain Administrator Password

Boot onto DVD of Windows Server 2008
Choose “Repair your computer”
Launch cmd
Go to c:\windows\system32
Rename Utilman.exe to Utilman.exe.bak
Copy cmd.exe to Utilman.exe
Reboot on Windows
Do the keyboard shortcut Windows + U when on the logon screen
net user administrator Newpass123 inside the cmd
log on with the domain admin account and this new pass
change the password to remember it if needed
Reboot on the DVD to put back the original Utilman.exe

Thx to mathieu chateau

Samstag, 9. Januar 2010

Remove Recovery Points XX Days

This Script allowes you to remove Recovery Points on a Microsoft Data Protection Manager 2007 Server, after XX Days.

Usage: RemoveRecoverypoints.PS1 "YourDPMserver" X
e.g.: RemoveRecoverypoints.PS1 "DPM01" 5
This will Remove All Recoverypoints, except those which are 5 max. days or less old.


param([string] $dpmname, [int32] $days )
function Usage()
{
write-host
write-host "Usage::"
write-host "RemoveRecoveryPoints.ps1 "DPMServername" Days(In int)"
write-host
}
if(("-?","-help") -contains $args[0])
{
Usage
exit 0
}
if(!$dpmname)
{
$dpmname = read-host "DPMServerName:"
}
if(!$days)
{
$days = read-host "Number of Days"
}
$pgList = Get-ProtectionGroup $dpmname
Foreach($pg in $pgList)
{
$Name = $pg.FriendlyName
Write-Host "Getting Data Source list for PG $Name..."
$dsList = Get-Datasource $pg
Foreach($ds in $dsList)
{
$Name = $ds.Name
Write-Host "Getting Recovery point list for Data-Source $Name ..."
$rpList = Get-RecoveryPoint $ds
Foreach($rp in $rpList)
{
$date = Get-Date
$datediff = $date - $rp.RepresentedPointInTime
$rpDays = $datediff.Days
Write-Host "Recovery Point is $rpDays days old "
if($rpDays -ge $days)
{
Write-Host "Removing Recovery Point older than $rpDays"
Remove-RecoveryPoint -RecoveryPoint $rp
}
}
}
}

Mittwoch, 30. Dezember 2009

Get the Service Tag from Dell computers

Get-WmiObject win32_SystemEnclosure | select serialnumber

WSUS automated Cleanup

This script performs the cleanup tasks done by the WSUS cleanup wizard. Because it is a script, it can be automated (for example, via the Windows Task Scheduler). It also provides extended support for computer cleanup, allowing one to specify the number of days of not hearing from the computer before cleanup (default is 30 days), and to optionally skip deletion of computers that are still in Active Directory Directory Services (to avoid accidently removing computers that are still around but having trouble contacting the server). We recommend also performing SQL defragmentation sample script as part of WSUS cleanup.
Thx to ScriptingGuys.

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")`
| out-null
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
$cleanupScope = new-object Microsoft.UpdateServices.Administration.CleanupScope;
$cleanupScope.DeclineSupersededUpdates = $true
$cleanupScope.DeclineExpiredUpdates = $true
$cleanupScope.CleanupObsoleteUpdates = $true
$cleanupScope.CompressUpdates = $true
#$cleanupScope.CleanupObsoleteComputers = $true
$cleanupScope.CleanupUnneededContentFiles = $true
$cleanupManager = $wsus.GetCleanupManager();
$cleanupManager.PerformCleanup($cleanupScope);

Exchange Autodiscover Song

You have to hear the Autodiscover Song :)

http://tinyurl.com/ylyrr6n

Lyrics:


Autodiscover

There is no other
Way to decide
Where your mailbox is stored


Autodiscover
Your sister and brother
Exchange Admin and mother
Will be proud if you do

You may be tempted to wing it
Use a hardcoded link submit it
But performance will suffer
When you’re left to your druthers
Should have Autodiscovered
Then all would be well


Chorus
Call it once for each mailbox of interest
Pair the link and mailbox for each request
If you encounter errors
Refresh once again
For more information search M-S-D-N for

Chorus

Exchange won't exist in a bubble
If you think that it will you're in trouble
Add a site, one or two
And your perf will be through
Unless you step up and decide that your app will just...

Chorus

Autodiscover,
Autodiscover,
Just AutoDiscover for me.
It’s just plain XML

Montag, 28. Dezember 2009

ISA Server 2006 - PPTP / RRAS Probleme mit Update KB956570

How to disable this update
If you encounter problems after you install this update, you can disable this update.

At the command prompt, type the following command:
cscript KB956570.vbs
Restart the computer that is running ISA Server.

----------------------------------------------------------------------------

Const SE_VPS_GUID = "{143F5698-103B-12D4-FF34-1F34767DEabc}"
Const SE_VPS_NAME = "BindRandomizationCount"
Const SE_VPS_VALUE = 0

Sub SetValue()

' Create the root object.
Dim root ' The FPCLib.FPC root object
Set root = CreateObject("FPC.Root")

'Declare the other objects needed.
Dim array ' An FPCArray object
Dim VendorSets ' An FPCVendorParametersSets collection
Dim VendorSet ' An FPCVendorParametersSet object

' Get references to the array object
' and the network rules collection.
Set array = root.GetContainingArray
Set VendorSets = array.VendorParametersSets

On Error Resume Next
Set VendorSet = VendorSets.Item( SE_VPS_GUID )

If Err.Number <> 0 Then
Err.Clear

' Add the item
Set VendorSet = VendorSets.Add( SE_VPS_GUID )
CheckError
WScript.Echo "New VendorSet added... " & VendorSet.Name

Else
WScript.Echo "Existing VendorSet found... value- " & VendorSet.Value(SE_VPS_NAME)
End If

if VendorSet.Value(SE_VPS_NAME) <> SE_VPS_VALUE Then

Err.Clear
VendorSet.Value(SE_VPS_NAME) = SE_VPS_VALUE

If Err.Number <> 0 Then
CheckError
Else
VendorSets.Save false, true
CheckError

If Err.Number = 0 Then
WScript.Echo "Done with " & SE_VPS_NAME & ", saved!"
End If
End If
Else
WScript.Echo "Done with " & SE_VPS_NAME & ", no change!"
End If

End Sub

Sub CheckError()

If Err.Number <> 0 Then
WScript.Echo "An error occurred: 0x" & Hex(Err.Number) & " " & Err.Description
Err.Clear
End If

End Sub

SetValue

Samstag, 26. Dezember 2009

Add Feature Microsoft .NET Framework 3.5. during Exchange 2010 Install

While installing Exchange 2010, you may get the following error message:

"You must use the Role Management Tool to install or configure Microsoft .NET Framework 3.5."

Cause Windows 2008 R2 ships with .Net 3.5.1, you just need to enable the feature within the Server Manager -> Features: