Fix broken trust using Powershell

When trying to log in to PC using a domain credential you get the following error:

“The trust relationship between this workstation and the primary domain failed” error when you log in to Windows 7

At this point I would usually re-join to the domain or run the Network Wizard, reboot, and continue on. There has to be a better way. And in-fact, there is via the Powershell command:

Reset-ComputerMachinePassword –server -credential

However, when I ran the command to reset the password I got an error stating the account could not be found on the domain controller:

PS C:\A3336> Reset-ComputerMachinePassword -server DELLR710 -credential AP\client_admin
Reset-ComputerMachinePassword : Cannot find the computer account for the local computer from the domain controller DELLR710.
At line:1 char:1
+ Reset-ComputerMachinePassword -server DELLR710 -credential AP\client_admin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (A3336:String) [Reset-ComputerMachinePassword], InvalidOperationException
    + FullyQualifiedErrorId : CannotFindMachineAccount,Microsoft.PowerShell.Commands.ResetComputerMachinePasswordCommand

PS C:\A3336>

The fix was to create the account on the domain controller which I was able to do with Powershell on another PC that had Remote Server Administration Tools (RSAT) installed.

    PS C:\AP01-1255-915> New-ADcomputer –name "A3336" –SamAccountName "A3336" -Enabled $true
    PS C:\AP01-1255-915>

Now when the command is run on the client PC I am prompted to enter a username and password with permission to join computers to the domain and the command completes successfully.

    PS C:\A3336> Reset-ComputerMachinePassword -server DELLR710 -credential AP\client_admin
    PS C:\A3336>

http://implbits.com/active-directory/2012/04/13/dont-rejoin-to-fix.html
https://ss64.com/ps/reset-computermachinepassword.html
https://support.microsoft.com/en-us/help/2771040/the-trust-relationship-between-this-workstation-and-the-primary-domain

Advertisement

Start remote PC using WOL and Powershell

How to power-on remote PC using wake-on-lan (WOL) and Powershell. Run from a Windows 7 Pro with Powershell running with domain admin credentials.

$Mac = "f0:92:1c:e3:8f:60"
$MacByteArray = $Mac -split "[:-]" | ForEach-Object { [Byte] "0x$_"}
[Byte[]] $MagicPacket = (,0xFF * 6) + ($MacByteArray  * 16)
$UdpClient = New-Object System.Net.Sockets.UdpClient
$UdpClient.Connect(([System.Net.IPAddress]::Broadcast),7)
$UdpClient.Send($MagicPacket,$MagicPacket.Length)
$UdpClient.Close()

PS C:\Install> ping -4 -t AP01-1221-314

Pinging AP01-1221-314.AP.local [10.10.1.130] with 32 bytes of data
Reply from 10.10.1.179: Destination host unreachable.
Reply from 10.10.1.179: Destination host unreachable.
Reply from 10.10.1.179: Destination host unreachable.
Reply from 10.10.1.179: Destination host unreachable.
Reply from 10.10.1.179: Destination host unreachable.
Reply from 10.10.1.179: Destination host unreachable.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 10.10.1.130: bytes=32 time=2ms TTL=128
Reply from 10.10.1.130: bytes=32 time=1ms TTL=128
Reply from 10.10.1.130: bytes=32 time=2ms TTL=128
Reply from 10.10.1.130: bytes=32 time=2ms TTL=128
Reply from 10.10.1.130: bytes=32 time=2ms TTL=128
Reply from 10.10.1.130: bytes=32 time=2ms TTL=128

Ping statistics for 10.10.1.130:
  Packets: Sent = 19, Received = 12, Lost = 7 (36% loss),
Approximate round trip times in milli-seconds:
  Minimum = 1ms, Maximum = 2ms, Average = 1ms
Control-C
PS C:\Install>

Just change MAC address and copy and paste. Of course, WOL must be enabled on remote PC for this to work.

Note: you’ll need Remote Server Administration Tools (RSAT) installed which you can download from Microsoft:
https://support.microsoft.com/en-us/help/2693643/remote-server-administration-tools-rsat-for-windows-operating-systems

PDF files not included in Windows Search on Windows 7 and 8

As you probably know searching is the most efficient way to find documents, applications, and settings in Windows 7 and 8. By clicking on the Start button and typing you can quickly find files containing specific text and phrases.

The mechanism that allows this is Windows Search that runs as a Windows service. Windows Search has it’s roots in the Indexing Service that first appeared in NT4 and Internet Information Services (IIS). Indexing involves building a catalog (index) that contains the meta-data for files and applications. The meta-data is retrieved via plugins called IFilters.

Windows Search by default includes IFilters for common filetypes, including Word documents, Excel spreadsheets, PowerPoint presentations, HTML files, text files, MP3 and WMA music files, WMV, ASF and AVI video files and JPEG, BMP and PNG images. PDF files are indexed by Windows Search using an IFilter installed automatically when Adobe Reader is installed. However, on 64-bit versions of Windows the IFilter is not installed and the Indexing Service is unable to parse and index these files. Fortunately, the fix is easy and can be done without a reboot.

First, to confirm the IFilter is not installed you need to open Indexing Options in the Control Panel. To do this click on Start and enter the text index. Windows will search for anything with “index” and display the Control Panel option Indexing Options.

Search for Indexing Options

When selected the Indexing Option window appears. This window tells you the status of the Indexing Service, the number items in the catalog, and the options to add or remove search locations. In the following example my computer has indexed 12,033 items.

Indexing Options before installing the PDF IFilter

Click on the button Advanced and then click on the tab File Types. Scroll down to the PDF extension. If the IFilter has not been installed the filter description will state Registered IFilter is not found as in the following screenshot:

Missing IFilter in Indexing Options

After confirming the IFilter is missing you can close the Indexing Options window and download Adobe’s IFilter for 64-bit Windows. The current version as of the time of this writing is PDF iFilter 64 11.0.01 and can be downloaded from Adobe’s HTTP site or FTP site.

Once downloaded, you can install it using an elevated command prompt (run Command Prompt as administrator) with the following command:

msiexec /i “C:\Install\PDFFilter64Setup.msi” REBOOT=R /qb /L*v c:\temp\install_ifilter.log

After the installation completes go back into Indexing Options and confirm the IFilter was installed and registered. The following screenshot shows that the Indexing Service will use an IFilter named “PDF Filter”.
Installed IFilter

Now, all that is left to do is to rebuild Windows Search index. Click on the Index Settings tab and then on the button labeled Rebuild.
Rebuilding Windows Search index

After clicking the Rebuild button Windows will display a warning, click OK to start the rebuild.
Rebuild warning

The status of the rebuild can be monitored on the Indexing Options window. While you are using your computer Windows will reduce the speed of the indexing operation.

Eventually (within an hour or two, depending on size of catalog) the index will be rebuilt and now contain search items from PDF files. On my computer the number of indexed items increased to 40,913.
Indexing Options

Search for a type of file in Windows 7

Challenge: You want to find all files of a certain type (like pictures or music) in Windows 7.

Solution: Use Windows Search Filters. Search filters are a feature in Windows 7 that make searching for files by their properties (such as by author or by file size) much easier.

You can even stack filters to narrow down the results:

Additional information: Microsoft

How to copy path AND filename in Windows 7

In order to share a file using UNC names you have to join together the file’s name and the file’s location or path. In Windows XP this meant clicking on the file as if to rename it and copy the name then click in the Address bar and paste the name at the end of the path. It is a small inconvenience but, an inconvenience none the less. At first glance it appears this shortcoming was carried over in Windows 7.

Hold down the Shift key and then right-click on the file. A new option in the context menu is available named “Copy as path”. This will copy the path and file name adding quotes around the address. You can then paste the address anywhere you need it.

Context menu in Windows 7

How to permanently disable Shadow in Windows 7

Out of the box Windows 7 adds a Shadow around all windows whether active or not. In most cases this enhances the display and makes it easier to focus on the active window. However, in some cases it can be distracting or you just don’t like it and want to remove it.

The first thing you need to do (and probably tried) is to change the Visual Effects under Performance Options like so: go into System Properties and click the Settings… button under Advanced:

Then uncheck the option Show shadows under windows and click OK:

After unchecking the option and closing the window the display immediately changes and all is good. Until you restart Windows. After restarting Windows the shadow most likely returned. If it didn’t then you are probably using Windows with administrative privileges which you should not do!

The problem appears to have surfaced way back in 2009 with Vista. It appears the registry setting to make the change permanent is being applied to the account entered when prompted by UAC. You would think 2 years later this would be fixed.

Then change the option and make the effect permanent you don't even need elevated privileges so, the UAC prompt should not even be called (at least not until you make a change that does require elevated privileges). Fortunately, the fix is quite easy:

  1. Press Windows Key + R to open the Run dialog
  2. Copy and paste the text SystemPropertiesPerformance into Run
  3. Make the change and click OK

Now, when the computer is restarted the effect will remain as set.

Credit: http://hardforum.com/showthread.php?t=1431776