Wednesday, July 30, 2014

The SoftwareDistribution Folder... Sigh...
Whats all this stuff in winsxs?

So I needed to make space on a system volume. According to my research (Yes, Mine!  Do Your Own!) This script safely cleans up SoftwareDistribution and winsxs.

Again.. Don't blindly trust some blogger.  Google an answer.

*ATTN*  The below script will delete data!  You've been warned.

@ECHO OFF

ECHO * This process deletes data forever!
ECHO * This process will delete files from: 
ECHO * C:\Windows\SoftwareDistribution and \Windows\winsxs
ECHO * Don't run this if you dont know what you are doing.
ECHO * Youll likely screw things up in a bad way.
ECHO * Renaming: \Windows\softwareDistribution to \Windows\softwareDistribution.old
net stop wuauserv
rename c:\windows\SoftwareDistribution softwaredistribution.old
net start wuauserv
ECHO *
ECHO * Check that the SoftwareDistribution Folder was created.
ECHO * Run WindowsUpdate and make sure it doesnt error.
wuauclt /ShowWUAutoScan
ECHO *
ECHO ***
ECHO *** At this point if there was an issue you could just replace
ECHO ***  the SoftwareDistribution Folder if there was an issue
ECHO *** I never had an issue
ECHO *** Continuing will delete data forever! ***
PAUSE
ECHO Deleting old SoftwareDistribution Folder (\windows\softwaredistribution.old)
del c:\windows\softwaredistribution.old /q /s
ECHO Done deleting folder
ECHO * Cleaning: \Windows\winsxs\
dism /online /cleanup-image /spsuperseded
ECHO *Done and done!
ECHO *

PAUSE
Enabling Network Discovery on Server 2008R2 (and maybe other OSes)

Feel free to Google to your hearts content to figure out why that "Turn on network discovery" option wont stay on.  Knowledge is power :)

Here is the fix.

(Yes, its old school cmd line.... Yes, Its probably easier in PS)

ECHO OFF
ECHO Setting DNS Client Service to Automatic
sc config "dnscache"  start= auto
ECHO Setting Function Discovery Resource Publication Service to Automatic
sc config "fdrespub"  start= auto
ECHO Setting SSDP Discovery Service to Automatic
sc config "ssdpsrv"  start= auto
ECHO Setting uPnP Device Host Service to Automatic
sc config "upnphost"  start= auto
ECHO -
ECHO Starting those services...
ECHO -
net start "DNS Client"
net start "Function Discovery Resource Publication"
net start "SSDP Discovery"
net start "UPnP Device Host"
ECHO - Ok, That part is done.
PAUSE
control /name Microsoft.NetworkAndSharingCenter /page Advanced
ECHO - Ok.. So *Now* you can "Turn on network discovery" in the page shown.
PAUSE

If this is helpful to you.. Cheers!

-Jeff