Description

This script is the start of one to help resolve Spiceworks Unknowns.

It will:

  1. Rebuild WMI (will give a couple of errors on win7 but will work ok)
  2. Setup the firewall
  3. Setup DCOM
  4. Win7 and Vista disable UAC (requires reboot)

I am working on full win7 support, anything else you would like to see added / changed PM me or leave a comment :slight_smile:

Also just to note windows7 will throw errors on the WMI rebuild and DCOM but seems to work…

This is based on the WMI Rebuild script.

Please note this is a work in progress and is not the official way off doing it. Read http://community.spiceworks.com/help/Resolving_Unknown_Devices for the “official way”

Source Code

Echo Rebuilding WMI... Please wait. > c:\SW_Setup.log
net stop sharedaccess >> c:\SW_Setup.log
net stop winmgmt /y >> c:\SW_Setup.log
cd %systemroot%\system32\wbem >> c:\SW_Setup.log
del /Q Repository >> c:\SW_Setup.log
c:
cd %systemroot%\system32\wbem >> c:\SW_Setup.log
rd /S /Q repository >> c:\SW_Setup.log
regsvr32 /s %systemroot%\system32\scecli.dll >> c:\SW_Setup.log
regsvr32 /s %systemroot%\system32\userenv.dll >> c:\SW_Setup.log
mofcomp cimwin32.mof >> c:\SW_Setup.log
mofcomp cimwin32.mfl >> c:\SW_Setup.log
mofcomp rsop.mof >> c:\SW_Setup.log
mofcomp rsop.mfl >> c:\SW_Setup.log
for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s
for /f %%s in ('dir /b *.mof') do mofcomp %%s 
for /f %%s in ('dir /b *.mfl') do mofcomp %%s 
mofcomp exwmi.mof >> c:\SW_Setup.log
mofcomp -n:root\cimv2\applications\exchange wbemcons.mof >> c:\SW_Setup.log
mofcomp -n:root\cimv2\applications\exchange smtpcons.mof >> c:\SW_Setup.log
mofcomp exmgmt.mof >> c:\SW_Setup.log
net stop winmgmt >> c:\SW_Setup.log
net start winmgmt >> c:\SW_Setup.log
gpupdate /force >> c:\SW_Setup.log

Echo Setting up fireall... Please wait. >> c:\SW_Setup.log
netsh firewall set service remoteadmin enable >> c:\SW_Setup.log
Echo Enable Ping >> c:\SW_Setup.log
netsh firewall set icmpsetting 8 >> c:\SW_Setup.log

Echo Dcom setup >> c:\SW_Setup.log
reg add HKLM\SOFTWARE\Microsoft\Ole /v LegacyAuthenticationLevel /t REG_DWORD /d "2" /f >> c:\SW_Setup.log
reg add HKLM\SOFTWARE\Microsoft\Ole /v LegacyImpersonationLevel /t REG_DWORD /d "3" /f >> c:\SW_Setup.log 


Echo Windows7 / Vista Stuff... Please ignore if you are not using. >> c:\SW_Setup.log
Echo Disable UAC >> c:\SW_Setup.log
%windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f >> c:\SW_Setup.log

Echo Win7 Firewall setup >> c:\SW_Setup.log
netsh advfirewall set currentprofile settings remotemanagement enable >> c:\SW_Setup.log
netsh advfirewall firewall set rule group="windows management instrumentation (WMI)" new enable=Yes  >> c:\SW_Setup.log
netsh advfirewall firewall set rule group="remote administration" new enable=yes >> c:\SW_Setup.log


Echo Please check the log c:\SW_Setup.log for any issues. >> c:\SW_Setup.log
Echo If using Windows7 or Vista please reboot. >> c:\SW_Setup.log

Echo Check winmgmt is started, there were problems with it not starting on win7 >> c:\SW_Setup.log
net start winmgmt >> c:\SW_Setup.log

echo Resetting Automatic Updates >> c:\SW_Setup.log
net stop bits 
net stop "Automatic Updates"
REM Automatic Updates for those German Users
net stop wuauserv
del /f /s /q %windir%\SoftwareDistribution\*.*
echo.
echo.
net start bits
net start "Automatic Updates"
net start wuauserv
echo Forcing AU detection and resetting authorization tokens... >> c:\SW_Setup.log
wuauclt.exe /resetauthorization /detectnow 
95 Spice ups

Turns Off UAC? Is that required or is just part of your prep for a PC? Maybe It’s me but I want end users machines on a Limited account with UAC. Anyway I’ll give it try tonight on my home network with SW 4.5ß.

Sorry it did orginally disable DCOM because i read the help pages wrong, but from around v2/3 this was fixed, it should just setup DCOM. Ive edited the description :slight_smile: forgot to do that earlier

Just having a play with the ones I have, I’ll let you know how I go on

Cool! But I can’t see any reason to turn off the UAC. I’ve no problems with Vista and UAC enabled. So I’d be put off from running this script on a problem machine.

I remembered from ages ago it needed to be turned off but looks like this has changed, ill fire up a test machine tomorrow and give it a whirl with it on :slight_smile: But if its designed to resolve unkowns is it not better to turn off incase its on too high or the user said no 2 it?

I didn’t say it correctly - I’d simply run this script with UAC disabling taken out. It’s definitely much better to have a script than do all that manually! So that’s a definite thumbs up! :wink:

Why you not rated it then :frowning: cries Nah its cool, im going to give it a whirl today and may change it to vbs if i can be bothered to give prompts on what you want to do

That makes life a bit easier, to date (not complaining I’ve only been using SW for a couple of weeks) I’ve been doing all this with problem machines by hand and no time to write and test a script. I havn’t yet had any dramas with UAC on Vista nor Windows 7 though so I’ll skip that bit till it’s a problem. Thanks Andy.

I undo the turn UAC off when complete. So far it’s working fine for me. Thanks!

Running Exclusively in XP so far, this script is invaluable for your inventory issues! AKP982, your community name might be a little 1992, but you Rock! Matter of Fact, I’m going to become a follower…and I don’t throw that around lightly.

Wickied :slight_smile: nice to know its working well No problem always happy to help :slight_smile:

How do you use this script? What machine do you put it on?

Save it as a .bat and the client machine your having problems with

Had machines where windows firewall was causing the issues in some cases. The ‘official’ way wasn’t working, tried this script on XP + Vista machines in the office and hey presto I can make use of spiceworks! Cheers AKP I owe you a pint!

Excellent work!

Hi, how do i use this script? Thanks

I appreciate your help but the device in question is a production 2003 server running SQL and I can’t tun a untested script on it. Basically can you tell me if Spiceworks requires ICS to be running? If it does then I cannot use Spiceworks because if I run ICS then this server cannot be accessed from remote locations.

This fixed a reluctant Win 7 PC for me. I’d followed all the official steps to no avail, and I have other Win 7 PCs that were OK. Don’t know what it fixed, but thanks! Mark

worked perfectly… finaly those denied is vanishing