Monday, December 31, 2012

w32tm time config

On one of the Domain Controllers : 
  • w32tm /configure /manualpeerlist: nl.pool.ntp.org /syncfromflags:manual /update
  • net stop w32time && net start w32time
  • w32tm /resync /rediscover

On member servers:
  • W32tm /config /syncfromflags:domhier /update
  • net stop w32time && net start w32time
  • W32tm /resync /rediscover 
Test :
  • w32tm /query /status
  • w32tm /query /source
  • w32tm /monitor

KMS Keys

To enable Key Management Service (KMS) or use Active Directory Based Activation (ADBA), a special key is used that tells the OS to use the organization's KMS or ADBA to activate, instead of the Microsoft online clearing service

slmgr.vbs /ipk <the KMS product key>

slmgr.vbs -skms <ip of you KMS> if you don't have a srv record or different domain
slmgr /ato

Friday, June 22, 2012

DNS SRV record Lync 2010

To create a DNS SRV record
  1. On the DNS server, click Start, click Control Panel, click Administrative Tools, and then click DNS.
  2. In the console tree for your SIP domain, expand Forward Lookup Zones, and then right-click the SIP domain in which your Office Communications Server will be installed.
  3. Click Other New Records.
  4. In Select a resource record type, click Service Location (SRV), and then click Create Record.
  5. Click Service, and then type _sipinternaltls.
  6. Click Protocol, and then type _tcp.
  7. Click Port Number, and then type 5061.
  8. Click Host offering this service, and then type the FQDN of the Standard Edition Server.
  9. Click OK.
  10. Click Done.

Or you can create this by using Powershell

New-DnsRecord -RecordType SRV -Server yourdnsserver.yourdomain.com -ZoneName yourdnszone.com -TTL 3600 -Priority 0 -Weight 0 -Port 5061 -TargetName lyncpool.yourdomain.com -Name "_sipfederationtls._tcp"

If you do not have the DNSShell you can download it here: http://dnsshell.codeplex.com/

Installation
  1. Extract DnsShell.zip to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DnsShell
  2. Run: Import-Module DnsShell



SIlverlight 5 APPCRASH with Lync Server 2010 Control Panel

Lync Control Panel: AdminUIHost AppCrash

Silverlight 5.1.10411.0 update combined with the AdminUIHost.exe component result:

Two possible workarounds:
  1.  Launch the Lync Control Panel from a web browser using the FQDN.https://admin.yourdomain.com  
  2. Uninstall Silverlight 5 and install Silverlight 4. You can download silverlight 4 here: http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0

Tuesday, June 19, 2012

Lync Server Control Panel: Navigation to the webpage was canceled

When this message appears:
Make sure the following settings are correct and in place:


Open IIS Manager:

Select Lync Server Internal Web Site and click on bindings in the action menu.

Select https and click edit.
Make sure the certificate is selected.
Have you created the A record in DNS? 
 




PasswordGenerator

PasswordGeneratorV2.ps1

$rs=[RunspaceFactory]::CreateRunspace()
$rs.ApartmentState = "STA"
$rs.ThreadOptions = "ReuseThread"
$rs.Open()
$ps = [PowerShell]::Create()
$ps.Runspace = $rs
$ps.Runspace.SessionStateProxy.SetVariable("pwd",$pwd)
[void]$ps.AddScript({ 


#Load Required Assemblies
Add-Type –assemblyName PresentationFramework
Add-Type –assemblyName PresentationCore
Add-Type –assemblyName WindowsBase
Add-Type -AssemblyName System.Windows.Forms


#Create Print Dialog object
$printDialog = New-Object System.Windows.Controls.PrintDialog


Function Create-Password {
#####################################################################
####################Password Specifications##########################
#####################################################################
        #How many characters in the password
        [int]$passwordlength = 14
        
        #Minimum Upper Case characters in password
        [int]$min_upper = 3
        
        #Minimum Lower Case characters in password
        [int]$min_lower = 3
        
        #Minimum Numerical characters in password
        [int]$min_number = 3
        
        #Minimum Symbol/Puncutation characters in password
        [int]$min_symbol = 3
        
        #Misc password characters in password
        [int]$min_misc = ($passwordlength - ($min_upper + $min_lower + $min_number + $min_symbol))
        
        If ($min_misc -lt 0) {
            [System.Windows.Forms.MessageBox]::Show("Password specification is not configured correctly, please make the proper edits and try again.","Warning") | Out-Null
            Break
            }
        
        #Characters for the password
        $upper = @("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
        $lower = @("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
        $number = @(1,2,3,4,5,6,7,8,9,0)
        $symbol = @("!","@","#","%","+","=","_")
        $combine = $upper + $lower + $number + $symbol
        
        $password = @()
        
        #Start adding upper case into password
        1..$min_upper | ForEach {$password += Get-Random $upper}
        #Add lower case into password            
        1..$min_lower | ForEach {$password += Get-Random $lower} 
        #Add numbers into password
        1..$min_number | ForEach {$password += Get-Random $number}
        
        #Add symbols into password
        1..$min_symbol | ForEach {$password += Get-Random $symbol}    
        
        #Fill out the rest of the password length
        1..$min_misc | ForEach {$password += Get-Random $combine}            
        
        $randompassword  = $Null
        
        #Randomize password
        Get-Random $password -count $passwordlength | ForEach {[string]$randompassword += $_}
        Return $randompassword    
    }


[xml]$xaml = @"
<Window
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    Height = '500' Width = '750' ResizeMode = 'NoResize' WindowStartupLocation = 'CenterScreen' 
    ShowInTaskbar = 'True' Title = 'Password Generator Version 5.0'>
    <Grid HorizontalAlignment="Stretch" ShowGridLines='false'>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="25"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="25"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height = '*'/>
            <RowDefinition Height = 'Auto'/>
            <RowDefinition Height = '*'/>
            <RowDefinition Height = '*'/>                
            <RowDefinition Height = '*'/>
            <RowDefinition Height = '*'/>
        </Grid.RowDefinitions>
        <Label Grid.ColumnSpan = '4' Grid.Column = '0' Grid.Row = '0' HorizontalAlignment = 'Center' Foreground = 'Green'
        FontWeight="Bold" FontSize="24" VerticalAlignment = 'Center'>
        FOR OFFICIAL USE ONLY
        </Label>
        <TextBlock Grid.ColumnSpan = '2' Grid.Column = '1' Grid.Row = '1' HorizontalAlignment = 'Center' TextWrapping = 'wrap'
        FontWeight="Bold" FontSize="15">
        Ensure your password contains at least 3 special characters, 3 numbers, 3 
        uppercase and 3 lowercase letters for a total of at least 14 characters long.
        </TextBlock> 
        <Label Grid.Column = '1' Grid.Row = '2' HorizontalAlignment = 'Right' VerticalAlignment = 'Center' FontSize = '16'
        FontWeight="Bold">
        Password:
        </Label>      
        <TextBox x:Name = 'PassTextBlock' Grid.Column = '2' Grid.Row = '2' HorizontalAlignment = 'left' VerticalAlignment = 'Center' FontSize = '16'
        FontWeight="Bold" IsReadOnly = 'True' Width = 'Auto'>
        NOTVALID
        </TextBox>
        <CheckBox x:Name = 'PrintCheckBox' Grid.Column = '1' Grid.ColumnSpan = '2' Grid.Row = '3' HorizontalAlignment = 'Center' IsChecked = 'True'
        VerticalAlignment = 'Center'>
        Send to Printer
        </CheckBox>
        <Button x:Name = 'GenButton' Grid.Column = '1' Grid.ColumnSpan = '2' Grid.Row = '4' HorizontalAlignment = 'Center' Height = '30'>
        Generate Password
        </Button>         
        <Label Grid.ColumnSpan = '4' Grid.Column = '0' Grid.Row = '5' HorizontalAlignment = 'Center' Foreground = 'Green'
        FontWeight="Bold" FontSize="24" VerticalAlignment = 'Center'>
        FOR OFFICIAL USE ONLY
        </Label>        
    </Grid>    
</Window>
"@
##Load XAML
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
$Window=[Windows.Markup.XamlReader]::Load( $reader )


##Controls
$GenButton = $window.FindName('GenButton')
$PassTextBlock = $window.FindName('PassTextBlock')
$PrintCheckBox = $window.FindName('PrintCheckBox')


##Events
#Generate Random password button
$GenButton.Add_Click({
    $PassTextBlock.Text = Create-Password
    [Windows.Forms.Clipboard]::SetText($PassTextBlock.Text)
    $window.UpdateLayout()
    If ($PrintCheckBox.IsChecked) {
        Try {
            #Print out form to default printer
            $printDialog.PrintVisual($window,'Window Print')
            }
        Catch {
            If ($error[0] -match "printqueue") {
                [windows.messagebox]::Show('No Default Printer specified!','Warning','OK','Exclamation')
                }
            Else {
                [windows.messagebox]::Show('Unknown Error Occurred!','Error','OK','Exclamation')
                }
            }
        
        }
    })  
#Clear password on close
$Window.Add_Closed({
    [Windows.Forms.Clipboard]::Clear()
    })          
$window.ShowDialog() | Out-Null
}).BeginInvoke()

Monday, June 18, 2012

DisableLoopbackCheck with powershell


Loopback fix server.
To set the DisableLoopbackCheck registry key,

New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1"