2

How-to : Recover totally bricked Nokia Lumia 820

-

When trying to recover my Lumia 820 from unsuccessful OS upgrade, phone went completely dead.

I was not able to turn it on or see any sign of activity in the device (boot manager damage happened probably).

At that stage I decided to look for tool which can recover my boot manager and then OS on Lumia.

Tool I found is available on Microsoft web site:

…and here is how it recovered my phone…

(more…)

0

How-to : Recover Nokia Lumia 820 when OS fails to load

-

When I tried to install Technical Preview of Windows 10 on my Nokia Lumia 820, I ended up with phone which went into infinite loop of updating.

As a result of that phone became unusable and there was no way to bring it back to life without any additional intervention.

To get phone back to life I used fostware available for free from Microsoft:

…and here is how that went…

(more…)

1

Tips & Tricks : Analyzing Windows memory.dmp file

-

Many times you think how to extract some information from memory.dmp generated by Windows once it crashes. Let’s have a look into quick process, which might be very helpful in many cases during troubleshooting unexpected BSODs on client computers.

Before we start we need tool, WinDbg, which is available on Microsoft.com. In order to download WinDbg go to WDK and WinDbg downloads on Microsoft. On that page locate section Standalone Debugging Tools for Windows (WinDbg).

Once you download and install WinDbg we are ready to start.

So, let’s see what’s in memory.dmp

(more…)

0

Code snippets : Execute SQL script using PowerShell

-

Recently I went through requirement of running SQL scripts on multiple databases on different servers. As the list of databases was different from script to script I decided to create universal solution, which will allow to easily prepare for deployment and can be simply reused at any time.

As a platform to execute scripts I went with PowerShell as that provides flexibility in case additional functionality will be required.

Whole solution contains 3 files:

  • SqlExecutionInflow.csv – file contains list of databases and servers where particular database is located. It is simple CSV file with 2 columns
  • SqlExecQuery.sql – contains SQL script which will be executed against all databases listed in SqlExecutionInflow.csv
  • SqlExec.ps1 – main script which load SqlExecInflow.csv and executes query from SqlExecQuery.sql

All files have to be placed in same folder. As a result script will create transcript file with output from all executed commands.

And here are example files and script itself…

(more…)

0

Code snippet : Sending email from PowerShell script

-

If you want to send email from PowerShell script via Google Mail:

$SMTPServer = "smtp.gmail.com"
$SMTPPort = "587"
$SMTPUsername = "sender@gmail.com"
$SMTPPassword = "password"

$EmailSenderAddress = New-Object System.Net.Mail.MailAddress("sender@gmail.com", "PowerShell Automated Email")

$EmailFrom = $EmailSenderAddress
$EmailTo = "recipient@gmail.com"
$EmailCc = "recipient@hotmail.com"
$EmailAttachment = "C:\Scripts\Attachment.txt"
$EmailSubject = "Automated Email with Report."
$EmailBody = @"
Please find attached report.
"@

$EmailMessage = New-Object System.Net.Mail.MailMessage
$EmailMessage.Subject = $EmailSubject
$EmailMessage.Body = $EmailBody
$EmailMessage.To.Add($EmailTo)
$EmailMessage.CC.Add($EmailCc)
$EmailMessage.From = $SMTPUsername
$EmailMessage.Attachments.Add($EmailAttachment)

$SMTPSession = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
$SMTPSession.EnableSSL = $true
$SMTPSession.Credentials = New-Object System.Net.NetworkCredential($SMTPUsername, $SMTPPassword);
$SMTPSession.Send($EmailMessage)
Write-Host "Mail Sent"
0

Code snippets : Encrypted password in PowerShell

-

Many times there is a need to store password in PowerShell script. Unfortunately to leave password in script is insecure solution and might cause an issue.

So, what to do if there is a need to have password in a script and we don’t want to have it embedded in clear-text in script?

Best way is to encrypt it and store in the file and then re-use it when required.

Create file with encrypted password

$secureString = Read-Host -AsSecureString "Enter a secret password"
$secureString | ConvertFrom-SecureString | Out-File C:\Scripts\storedPassword.txt

Use encrypted password in script

$secureString = Get-Content -Path C:\Scripts\storedPassword.txt | ConvertTo-SecureString
Remember that password has to be encrypted on the account which will be running the script. So, in case you plat to use Task Scheduler to run PowerShell script, start PowerShell windows as particular user and then create file with encrypted password.