Posts

PowerShell domain disk statistics report

Image
Ever needed an automated disk statistics report for your Windows domain?  I did.  I was able to gather bits and pieces from around the Internet and create the script below. It's designed for my needs but can be easily edited to suit yours.  The basic functionality is to use WMI via PowerShell to poll servers, PCs, or both and grab disk usage for any system within the targeting parameters and generate an easy to read HTML report that is emailed to anyone needed. Our environment is comprised of both physical and virtual systems.  I need to be able to spot systems running low on disk space with expandable disks (virtual) that can be quickly grown if needed.  The output color codes C: drives below 60 GB in red, that's my low threshold.  It also color codes physical verses virtual.  You can select between a full report of every system, or a brief option for only systems below threshold.  You can also filter by server or PC and turn console out...

Redhat / Centos ShellShock remediation

I realize it's old info now but I'm posting this for my own reference.  This info was gleaned from other sites.  I adapted the tests to display results in color.  Hey I'm old, it helps to see things  :-) The tests are listed as Redhat or Centos but the same script should work on any version of Linux and probably Unix as well. BASH ShellShock Remediation Redhat/Centos version: cat /etc/redhat-release BASH version: bash -version     Or rpm -qa | grep bash Test:  clear;env x="() { :;}; echo -e '\033[1;31mVULNERABLE\033[0m'" "BASH_FUNC_x()=() { :;}; echo VULNERABLE" bash -c " echo -ShellShock-Test-"    Or clear;env X="() { :;} ; echo -e '\033[1;31mVULNERABLE\033[0m'" /bin/sh -c "echo -ShellShock-Test-" Result before patching: VULNERABLE bash: BASH_FUNC_x(): line 0: syntax error near unexpected token `)' bash: BASH_FUNC_x(): line 0: `BASH_FUNC_x() () { :;}; echo VULNERA...

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...