Monthly Archives: April 2015

Microsoft MVP Virtual Conference 2015

MVPvConf

This is a great free event that Microsoft and the MVPs are putting on, May 14th & 15th. Join Microsoft MVPs from the Americas’ region as they share their knowledge and real-world expertise during a free event, the MVP Virtual Conference.

The MVP Virtual Conference will showcase 95 sessions of content for IT Pros, Developers and Consumer experts designed to help you navigate life in a mobile-first, cloud-first world. Microsoft’s Corporate Vice President of Developer Platform, Steve Guggenheimer, will be on hand to deliver the opening Key Note Address.

Why attend MVP V-Conf? The conference will have 5 tracks, IT Pro English, Dev English, Consumer English, Portuguese mixed sessions & Spanish mixed sessions, there is something for everyone!

Come learn from the best and brightest in the tech world today. All of the sessions will all be delivered by the Americas’ Region Microsoft MVPs. These MVPs are experts who present at premiere conferences, independent community events and local user groups all over the globe.

This is a technical conference focused on helping attendees to learn and develop skills for everything from everyday technical work to wackier weekend projects. Whether it is on the IT Pro, Dev or Consumer side of things, you can bet that the content of MVP V-Conf will be cutting edge, exciting and relevant.

Be sure to register quickly to hold your spot and tell your friends & colleagues.

The conference will be widely covered on social media, you can join the conversation by following @MVPAward and using the hashtag #MVPvConf.

Start-DSCConfiguration WMF 5.0 Multiple Nodes Issue

I am one among the many beginners in PowerShell Desired State Configuration. Recently I saw the TechNet Forum Post so thought of sharing my experience

Error

The WinRM client cannot process the request. The object contains an unrecognized argument: “JobId”. Verify that the spelling of the argument name is
correct.
    + CategoryInfo          : MetadataError: (root/Microsoft/…gurationManager:String) [], CimException
    + FullyQualifiedErrorId : HRESULT 0x803381e1
    + PSComputerName        : DSC2

How to Produce this in WMF 5.0?
Configuration DesiredStateConfigurationDemo
{
    Param([String[]]$ComputerName)
    Import-DscResource -ModuleName xWindowsUpdate
    Node $computerName
    {
        
        xHotFix InstallWMF5
        {
            Path = '\\DSC1\C$\DSCShare\Updates\Some.MSU'
            Id = 'KBsomeid'
            Ensure = 'Present'
        }
    }
}

DesiredStateConfigurationDemo -ComputerName DSC1 , DSC2
Start-DSCConfiguration .\DesiredStateConfigurationDemo -wait -verbose -force

In middle of demo I couldn’t think about anything else. Since few of my clients were eager to get advantages of DSC – So, I just applied configuration using below code – Our Own PowerShell 🙂

'DSC1' , 'DSC2' | %{Start-DSCConfiguration .\DesiredStateConfigurationDemo -ComputerName $_ -wait -verbose -force}

 

 

Upload High Resolution Picture in Exchange Online

Set-UserPhoto Error – Now Solved 🙂

Error:

 

Proxy method PSWS:
Request return error with following error message:
The remote server returned an error: (413) Request Entity Too Large…
+ CategoryInfo          : NotSpecified: (:) [Set-UserPhoto], CmdletProxyException
+ FullyQualifiedErrorId : Microsoft.Exchange.Configuration.CmdletProxyException,Microsoft.Exchange.Management.RecipientTasks.SetUserPhoto

More Information:

Logged an issue in Connect

Refer to the Workaround posted which might have helped some. Unfortunately it didn’t work in WMF 4.0 at all. Recently, I thought of testing the case in Connect to explore some foot prints.

Reason:

The reason for the error is quite simple – Exchange Online will not allow images greater than 10 KB and 96 x 96

 Solution:

I tried to upload an image using the below PowerShell Code

Set-UserPhoto "Chendrayan" -PictureData ([System.IO.File]::ReadAllBytes("C:\Temp\TestImage.jpg")) -Confirm:$false
Image Information:
2015-04-14_13-38-27
Conclusion:

Updated TechNet Article

Query AD and Update SQL Express Table Using PowerShell

Requirement

Query AD [Active Directory] computers and insert into SQL Express.

Considerations

Requirement is just an one liner. We need to consider a lot before we deliver this to production.

  • Do we need all computers from AD or just enabled? Yeah! We need only enabled computers. If Admin disables / enables a computer or remove / adds a computer in AD the SQL express table should update accordingly.
  • Do we need only client operating systems? Yeah! We need this is for Client OS reporting.

Summary

To summarize the requirement customer needs a solution which should do the below tasks.

  • Insert if new Computer found in AD.
  • Drop if computer is removed.
  • Update properties if any change identified.

Solution

  • Query AD with Filter ON [Enabled -eq $true and OperatingSystem -eq ‘Windows 7 Enterprise’].
  • Insert If exists.
  • Drop Row if SQL Express rows doesn’t match AD value.[Removed from AD but exists in SQL table]
  • If new computer found insert into table.

PowerShell Code

 #Establish Connection to SQL Express
$conn = New-Object System.Data.SqlClient.SqlConnection("Data Source=Localhost\SQLExpress; Initial Catalog=Employee; Integrated Security=SSPI")
$conn.Open()

#Query AD and Update SQL Table
Get-ADComputer -Filter {(Enabled -eq $true) -and (OperatingSystem -eq 'Windows 7 Enterprise')} -Properties * | %{

$Name = $_.Name 
$OS = $_.OperatingSystem 
$LastLogonDate  = $_.LastLogonDate 
$PasswordLastSet = $_.PasswordLastSet
$Description = $_.Description 
$DN = $_.DistinguishedName
$Enabled = $_.Enabled

$cmd = $conn.CreateCommand()
$query = @"
IF EXISTS (Select * from ComputerInformation Where ComputerName = '$Name')
Delete from ComputerInformation where ComputerName <> '$Name'
ELSE
INSERT INTO ComputerInformation VALUES ('$Name' , '$OS' , '$LastLogonDate' , '$PasswordLastSet' , '$Description' , '$DN' , '$Enabled')
"@
$cmd.CommandText = $query
$cmd.ExecuteNonQuery()
}

#Close the connection
$conn.Close()

 

Exploring LYNC Contacts Using PowerShell

Exploring LYNC Contact folders using PowerShell.

Get-MailboxFolderStatistics will display all the folders information in users mailbox. So using this we can explore LYNC Contacts with the folder type ‘Quick Contacts’.

Get-MailboxFolderStatistics -Identity <MailboxID> | 
? {$_.FolderType -eq 'QuickContacts'}

Lync Contact Folders with 0 EntriesLync Contact Folders with 0 Entries

If we delete lync contacts programmatically it may appear as GUID as well. Like shown below.

Get-MailboxFolderStatistics -Identity <MailboxID> | 
Select Name , ItemsinFolder | ft -AutoSize

2Underneath Contacts we can see two GUID – That’s LYNC and GAL Contacts

Refer this article to remove LYNC contact entries using PowerShell and EWS

How to Explore all folders?