Tuesday 14 October 2014

PowerShell: Export Computer Accounts with Last Account Password Change

When looking for machines sometimes it is nice to know if they have even talked to the domain recently. Here is some quick PowerShell to get you on your way.

Get-ADComputer -Filter 'ObjectClass -eq "Computer"' -Properties PasswordLastSet | FT Name,PasswordLastSet > output.txt

FYI: Make sure to install the Active Directory Module for PowerShell

UE-V Throws an Exception on Install

Now that I've been using UE-V lately for customer environments I've noticed a very bizarre error that can pop up when installing the UE-V 2.0 agent or tools. As you can see below the error message that comes up is rather frightening and suggests that there is something very wrong with the installation.




If I navigate to the %temp% folder on the machine I am attempting to install the UE-V agent on you will notice that the Microsoft_User_Experience_Virtualization_Agent_<YYYYMMDDHHMMSS>.log isn't exactly making the issue obvious.

[0E70:0E74][2014-09-27T10:40:27]: Burn v3.6.3303.0, Windows v6.1 (Build 7601: Service Pack 1), path: D:\UE-V\Installers\2.0\AnyCPU\AgentSetup.exe, cmdline: '-burn.unelevated BurnPipe.{87244650-D62D-4444-979C-45197BB6BDD0} {4F666BD9-6261-485E-B93B-0C66CB718C68} 3676'
[0E70:0E74][2014-09-27T10:40:27]: Setting string variable 'WixBundleLog' to value 'C:\Users\ADMINI~1\AppData\Local\Temp\Microsoft_User_Experience_Virtualization_Agent_20140927104027.log'
[0E70:0E74][2014-09-27T10:40:27]: Setting string variable 'WixBundleOriginalSource' to value 'D:\UE-V\Installers\2.0\AnyCPU\AgentSetup.exe'
[0E70:0E74][2014-09-27T10:40:27]: Condition 'VersionNT >= v6.1' evaluates to true.
[0E70:0E74][2014-09-27T10:40:27]: Setting string variable 'WixBundleName' to value 'Microsoft User Experience Virtualization Agent'
[0E70:0E74][2014-09-27T10:40:28]: Loading managed bootstrapper application.
[0E70:0E74][2014-09-27T10:40:28]: Creating BA thread to run asynchronously.
[0E70:0EAC][2014-09-27T10:40:29]: Running WixBa
[0E70:0E74][2014-09-27T10:40:29]: Detect 2 packages
[0E70:0E74][2014-09-27T10:40:29]: Setting string variable 'ISNETFRAMEWORK40' to value '1'
[0E70:0EAC][2014-09-27T10:40:29]: Creating a UI
[0E70:0E74][2014-09-27T10:40:29]: Detected package: AgentSetupx86.msi, state: Absent, cached: None
[0E70:0E74][2014-09-27T10:40:29]: Detected package: AgentSetupx64.msi, state: Absent, cached: None
[0E70:0E74][2014-09-27T10:40:29]: Detect complete, result: 0x0
[0E70:0EAC][2014-09-27T10:44:03]: Setup has thrown an exception. Please check the log.
[0E70:0EAC][2014-09-27T10:44:03]: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. (Exception from HRESULT: 0x80070422)
[0E70:0EAC][2014-09-27T10:44:04]:    at WuApiTypeLib.IUpdateServiceManager2.get_Services()
   at Microsoft.Uev.Deployment.ManagedBootstrapperApplication.Views.RootView.CheckMuOptIn()
   at Microsoft.Uev.Deployment.ManagedBootstrapperApplication.Views.RootView.NextButton_Click(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at Microsoft.Uev.Deployment.ManagedBootstrapperApplication.WixBa.Run()
[0E70:0E74][2014-09-27T10:44:04]: Shutting down, exit code: 0x6
[0E70:0E74][2014-09-27T10:44:04]: Variable: ISNETFRAMEWORK40 = 1
[0E70:0E74][2014-09-27T10:44:04]: Variable: VersionNT = 6.1.0.0
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleAction = 4
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleElevated = 1
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleInstalled = 0
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleLog = C:\Users\ADMINI~1\AppData\Local\Temp\Microsoft_User_Experience_Virtualization_Agent_20140927104027.log
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleName = Microsoft User Experience Virtualization Agent
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleOriginalSource = D:\UE-V\Installers\2.0\AnyCPU\AgentSetup.exe
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleProviderKey = {e7f590ad-0947-4f42-8739-2d519a5f210e}
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleTag =
[0E70:0E74][2014-09-27T10:44:04]: Variable: WixBundleVersion = 2.0.319.0
[0E70:0E74][2014-09-27T10:44:04]: Exit code: 0x6, restarting: No

The key to understanding this error is the call made to use the Windows Update engine.
[0E70:0EAC][2014-09-27T10:44:04]:    at WuApiTypeLib.IUpdateServiceManager2.get_Services()

And if you search on the Internet you can find more information on the call made.


The details in the article aren't terribly important but it gives us an idea what the issue is, as  a result I checked what was the current state of the Windows Update service. When this service was checked it was disabled  because this was one of my sequencing machines so following the App-V best practice I had the service turned off. UE-V will work fine if the service is disabled afterward but it must be running in order for the installation to work correctly. So far I have seen this issue on Windows 7 x64 and 8.1 x64 systems and assume it will fail on many others.