Posts

PowerShell won't run Excel from a scheduled task

Just ran head-on into what appears to be a bug in the .NET Excel object in PowerShell. It appears to be a known bug but there is not a lot of info about it.   The bug does not allow Excel to be run from a task in windows task scheduler unless the task author has checked the “user has to be logged on to run” option. The issue is that Excel tries to do a “CreateFile” operation in “C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet Files”.   The problem is that the Temporary Internet Files folder doesn’t exist in that location. Until Microsoft fixes this the solution work-around is to create two folders: "C:\Windows\System32\config\systemprofile\Desktop" (Create on  both 32 bit and 64 bit systems) "C:\Windows\SysWOW64\config\systemprofile\Desktop" (Create only on 64 bit systems) Once these are created and the scheduled task is re-run, everything should work fine regardless if you are running the task wit...

Use PowerShell to audit domain member local admins.

This PowerShell script was written to facilitate an audit of the local admin groups on all systems in our domain.  It will remove invalid accounts, or add new ones, or simply report what it finds. *******  Updated version ******* #Region Header #====================================================================================== #         File Name : Audit-And-Purge-LocalAdmins.ps1 #   Original Author : Kenneth C. Mazie (kcmjr AT kcmjr.com) #                   : #       Description : Used to audit and manage the local administrators group on domain computers. #                   : #             Notes : Original version rewrit...