Thursday, November 10, 2016

Powershell script for retrieving stored wireless passwords

On W10 it is trivially easy to retrieve stored passwords for wireless netwerk. I cobled the following script together to store the passwords before a migration. Note that this assumes an English version of Windows, on some machines you may need to modify the 'User Profiles' and 'Key Content' strings.

Run the following to find the string on your system;



And



And the full script:

$output = netsh wlan show profiles
$from = $output.IndexOf("User profiles")

$output = $output[($from+2)..($output.length-2)]

$results = @()

foreach ($entry in $output) {
  $networkName = ($entry.Split(':')[1]).Trim()

  $networkInfo = netsh wlan show profile name=$networkName key=clear

  foreach($infoLine in $networkInfo) {
    if ($infoLine.Trim().StartsWith("Key Content")){
      $password = ($infoLine.Split(':')[1]).Trim()

      if ($password -ne "Absent"){
        Write-Host Processing $networkName
        $networkProperties = @{
          Name = $networkName
          Password = $password
        }
                      $results += (New-Object PSObject -Property $networkProperties)
      }
    }
  }
}

$results | ft Name,Password


Monday, September 19, 2016

Change password in nested RDP session

Just documenting two methods that work, since I'm tired of googling this every few months:

1. PowerShell command:
(New-Object -COM Shell.Application).WindowsSecurity()

2. On screen keyboard

- Start OSK in the session you want to change the password for
- Hold Ctrl+Alt on your physical keyboard
- Press Del on the OSK

Monday, February 29, 2016

Downloading from MSDN and Microsoft with Internet Explorer

Internet Explorer on Windows Server (2012) is locked down. In an attempt to make the browser more secure, scripts downloaded from untrusted domains can not be executed. This makes downloading the software you need to install on the server difficult.

Usually, you would use another machine for downloading. However, if that's not an option, and you don't want to install another browser or open all security settings for Internet Explorer, you'll need to reconfigure Internet Explorer to trust some specific domains. I've noted below the domains I had to add to my trusted sites list, in order to get MSDN and Microsoft downloads to work. Add them by clicking the "cog wheel" -> "Internet Options" -> "Security" -> "Trusted Sites" -> "Sites". Then add the URL's and press "Add"  for everyone.

For MSDN Subscriber Downloads

  • https://auth.gfx.ms
  • https://login.live.com
  • https://*.sec.s-msft.com
  • https://ajax.aspnetcdn.com
  • https://*.microsoft.com
  • http://download.msdn.microsoft.com
Microsoft downloads (www.microsoft.com)

  • https://assets.onestore.ms
  • https://mem.gfx.ms
  • https://*.s-microsoft.com

Also ensure you have script execution enabled for trusted sites: "cog wheel" -> "Internet Options" -> "Security" -> "Trusted Sites" -> "Custom Level"





Rating