Programming/Scripting
SBS 2008 Company Name in RWW
by seb on Sep.07, 2009, under Programming/Scripting, Work
So I recently set up a Small Business Server 2008 for a customer. In getting it prepped prior to installing the machine onsite, I set up some of the basic functions (as much as I could without it actually being there). One of the things I screwed up on was the company name that shows up when you hit the base Remote Web Workplace page:
Luckily, there is a very simple way to correct this. I wasn’t able to find any answers online, so maybe this is common knowledge for SBS admins. First, locate the following file:
C:\Program Files\Windows Small Business Server\Data\RWWConfig.xml
Give your domain admin user full rights to this file, accepting any UAC prompts along the way. Next, open the file in notepad, and you’ll have a file that looks similar to the following:
<?xml version="1.0" encoding="utf-8"?> <RWWConfig> <fileName>RWWPluginSBS, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</fileName> <className>Microsoft.WindowsServerSolutions.IWorker.RWW.RWWPluginSBS</className> <signinOrgName>WrongName, Inc.</signinOrgName> <signinBackgroundImage>images/background.jpg</signinBackgroundImage> <signinUserBackgroundImage></signinUserBackgroundImage> <orgLogo></orgLogo> <wssgLogo>images/RwwOemLogo.png</wssgLogo> <readEmailIcon>images/E-mail.png</readEmailIcon> <connectToComputerIcon>images/RemoteDesktop.png</connectToComputerIcon> <internalWebSiteIcon>images/CompanyWeb.png</internalWebSiteIcon> <changePasswordIcon>images/changepassword.png</changePasswordIcon> <helpDocumentationIcon>images/Help32.png</helpDocumentationIcon> <adminConsoleIcon>images/AdminConsole.png</adminConsoleIcon> <helpDeskIcon>images/helpdesk.png</helpDeskIcon> <techNetIcon>images/technet.png</techNetIcon> <showOWALink>true</showOWALink> <showTSLink>true</showTSLink> <showSharepointLink>true</showSharepointLink> <showChangePasswordLink>true</showChangePasswordLink> <showHelpDocumentationLink>true</showHelpDocumentationLink> <showAdminConsoleLink>true</showAdminConsoleLink> <showHelpDeskLink>true</showHelpDeskLink> <showWebGadget>true</showWebGadget> <showCustomOrgLinks>true</showCustomOrgLinks> <showCustomAdminLinks>true</showCustomAdminLinks> </RWWConfig>
If you don’t already see it, find the following line to edit the organization name:
<signinOrgName>WrongName, Inc.</signinOrgName>
Simply change this name to whatever the correct name is, or anything you want to be displayed there:
<signinOrgName>RightName, Inc.</signinOrgName>
Refresh your RWW page, and there you have it:
There are a ton of other options in that particular XML file, so poke around.
Movie List, Computer Stats
by seb on Jan.11, 2009, under My Desktop, Programming/Scripting
Over the past few days I’ve gotten bored with my website and decided to add some more interesting information. Two new pages have been added: Movie List and Computer Stats. Both pages update periodically with current information. The Movie List page updates about once every hour, and the Computer Stats page updates about once every minute. As long as my computer is on, these pages will keep updating regularly.
For those of you who want to know how I did this, here’s some poorly written code, with brief explanations and no comments:
MakeMovieList.bat: This file gathers the list of movies I have in folders sorted by type (MKV, WMV), sorts it, then uploads it to my website for parsing through PHP. The PHP is dependent on the file names being consistent, so there’s some maintenance involved, but not much.
1 2 3 4 5 6 7 8 9 10 11 | @echo off if exist C:\scripts\movielist.txt del C:\scripts\movielist.txt /Q pushd D:\Movies\wmv dir *.wmv /B>>C:\scripts\movielist.txt popd pushd D:\Movies\mkv dir *.mkv /B>>C:\scripts\movielist.txt popd sort C:\scripts\movielist.txt /O C:\scripts\movielist.txt ftp -s:C:\scripts\ftp-upload-movielist.txt theseb.com del C:\scripts\movielist.txt /Q |
FTP-Upload-MovieList.txt: This is the FTP script used by the batch above. All it does is upload the list to an FTP.
1 2 3 4 5 6 7 | ftpusername
ftppassword
ascii
cd public_html
put C:\scripts\movielist.txt
close
quit |
Movie List PHP Source: Here’s the PHP for parsing the text file that was uploaded in the previous step. Credit to John for writing it for me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | $str = file_get_contents("/home/seb/public_html/movielist.txt"); $list = explode("\n",$str); $i = 1; foreach($list as $key => $moviedata) { $temp = explode(").",$moviedata); $temp1 = explode("(",$temp[0]); $name = trim($temp1[0]); $movies["$name"][res] = trim($temp1[1]); $movies["$name"][ext] = strtolower(trim($temp[1])); } foreach($movies as $name => $movie) { if($name == '') { unset($movies[$name]); } } echo "<table border=\"0\" id=\"movielisttable\">"; echo "<tr><th>Title</th><th>Resolution</th><th>Container</th></tr>"; foreach($movies as $name => $movie) { echo "<tr><td class=\"movietitle\"><a href=\"http://www.imdb.com/find?q=$name;s=tt\" target=\"_blank\">$name</a></td> <td class=\"movieresolution\">$movie[res]</td> <td class=\"moviecontainer\">$movie[ext]</td></tr>\n"; } echo "</table>"; |
MakeComputerStats.bat: This batch calls up the VBScript that does all of the work, so there’s not much here. Also in there is the call to the FTP command.
1 2 3 4 5 | @echo off if exist C:\scripts\computer-stats.txt del C:\scripts\computer-stats.txt /Q cscript //NoLogo C:\scripts\computer-stats.vbs>C:\scripts\computer-stats.txt ftp -s:C:\scripts\ftp-upload-computer-stats.txt theseb.com del C:\scripts\computer-stats.txt /Q |
FTP-Upload-Computer-Stats.txt: Yet another FTP upload, this time for the computer stats.
1 2 3 4 5 6 7 | ftpusername
ftppassword
ascii
cd public_html
put C:\scripts\computer-stats.txt
close
quit |
Computer-Stats.vbs: Here’s the biggie, the VBScript that actually gathers all the data. It basically does a few calls to WMI and outputs information in HTML form, so that I can just do a php include on the Computer Stats page itself. I’m not sure why I didn’t do this for the Movie List page, but I’m too lazy to change it at this point. There’s also a function for simplifying long values, in bytes, into another, more-readable form like KB, MB, GB, or TB. I’m sure there’s an easier way to do all of this, but I felt like challenging myself last night, out of boredom.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | on error resume next Function SetBytes(Bytes) If Bytes >= 1099511627776 Then SetBytes = Round(FormatNumber(Bytes / 1024 / 1024 / 1024 / 1024, 2), 2) & " TB" ElseIf Bytes >= 1073741824 Then SetBytes = Round(FormatNumber(Bytes / 1024 / 1024 / 1024, 2), 2) & " GB" ElseIf Bytes >= 1048576 Then SetBytes = Round(FormatNumber(Bytes / 1024 / 1024, 2), 2) & " MB" ElseIf Bytes >= 1024 Then SetBytes = Round(FormatNumber(Bytes / 1024, 2), 2) & " KB" ElseIf Bytes < 1024 Then SetBytes = Bytes & " Bytes" Else SetBytes = "0 Bytes" End If End Function SSection="<h3 class=""CompStatsHeader"">" ESection="</h3>" STable="<table id=""CompStatsTable"">" ETable="</table>" SItem="<tr><td class=""CompStatsItem"">" EItem="</td>" SValue="<td class=""CompStatsValue"">" EValue="</td></tr>" Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2") '''OS INFORMATION wscript.echo SSection & "Operating System" & ESection & STable Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For Each objItem in colItems wscript.echo SItem & "Version:" & EItem & SValue & "Microsoft Windows Vista Ultimate, " & objItem.CSDVersion & EValue wscript.echo SItem & "Architecture:" & EItem & SValue & objItem.OSArchitecture & EValue wscript.echo SItem & "Registered To:" & EItem & SValue & objItem.RegisteredUser & EValue wscript.echo SItem & "Local Date:" & EItem & SValue & Date & EValue wscript.echo SItem & "Local Time:" & EItem & SValue & Time & EValue wscript.echo SItem & "Running Processes:" & EItem & SValue & objItem.NumberOfProcesses & EValue wscript.echo SItem & "Total Physical Memory:" & EItem & SValue & SetBytes(objItem.TotalVisibleMemorySize*1024) & EValue wscript.echo SItem & "Available Physical Memory:" & EItem & SValue & SetBytes(objItem.FreePhysicalMemory*1024) & EValue wscript.echo SItem & "Total Virtual Memory:" & EItem & SValue & SetBytes(objItem.TotalVirtualMemorySize*1024) & EValue wscript.echo SItem & "Available Virtual Memory:" & EItem & SValue & SetBytes(objItem.FreeVirtualMemory*1024) & EValue ' wscript.echo SItem & "Pagefile Total Size:" & EItem & SValue & SetBytes(objItem.TotalSwapSpaceSize*1024) & EValue wscript.echo SItem & "Pagefile Free Space:" & EItem & SValue & SetBytes(objItem.FreeSpaceInPagingFiles*1024) & EValue wscript.echo SItem & "Logged In Users:" & EItem & SValue & objItem.NumberOfUsers & EValue Next wscript.echo ETable '''PROCESSOR INFORMATION wscript.echo SSection & "Processor" & ESection & STable Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") For Each objItem in colItems wscript.echo SItem & "Processors:" & EItem & SValue & objItem.NumberOfProcessors & EValue Next Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor") For Each objItem in colItems wscript.echo SItem & "Cores:" & EItem & SValue & objItem.NumberOfCores & EValue wscript.echo SItem & "Manufacturer:" & EItem & SValue & objItem.Manufacturer & EValue wscript.echo SItem & "Model:" & EItem & SValue & objItem.Name & EValue wscript.echo SItem & "Revision:" & EItem & SValue & objItem.Version & EValue wscript.echo SItem & "Socket:" & EItem & SValue & objItem.SocketDesignation & EValue wscript.echo SItem & "Load:" & EItem & SValue & objItem.LoadPercentage & "%" & EValue wscript.echo SItem & "Voltage:" & EItem & SValue & objItem.CurrentVoltage/10 & "V" & EValue Next wscript.echo ETable '''VIDEO INFORMATION wscript.echo SSection & "Video" & ESection & STable Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController") Cards=0 For Each objItem in colItems Cards=Cards+1 Next Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController where DeviceID = 'VideoController1'") For Each objItem in colItems wscript.echo SItem & "Cards:" & EItem & SValue & Cards & EValue wscript.echo SItem & "Model:" & EItem & SValue & objItem.Description & EValue wscript.echo SItem & "Current BPP:" & EItem & SValue & objItem.CurrentBitsPerPixel & "bpp" & EValue wscript.echo SItem & "Resolution:" & EItem & SValue & objItem.CurrentHorizontalResolution & "x" & objItem.CurrentVerticalResolution & EValue wscript.echo SItem & "Colors:" & EItem & SValue & objItem.CurrentNumberOfColors & EValue wscript.echo SItem & "Refresh Rate:" & EItem & SValue & objItem.CurrentRefreshRate & "MHz" & EValue wscript.echo SItem & "Driver Version:" & EItem & SValue & objItem.DriverVersion & EValue Next wscript.echo ETable '''Disk INFORMATION Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk where Name='C:' or Name='D:' or Name='X:'") For Each objItem in colItems wscript.echo SSection & "Disk '" & objItem.VolumeName & "'" & ESection & STable wscript.echo SItem & "Drive Letter:" & EItem & SValue & objItem.Name & EValue wscript.echo SItem & "Filesystem:" & EItem & SValue & objItem.FileSystem & EValue wscript.echo SItem & "Size:" & EItem & SValue & SetBytes(objItem.Size) & EValue wscript.echo SItem & "Free Space:" & EItem & SValue & SetBytes(objItem.FreeSpace) & EValue wscript.echo SItem & "Used Space:" & EItem & SValue & SetBytes(objItem.Size-objItem.FreeSpace) & EValue Set colItems2 = objWMIService.ExecQuery("Select * from win32_perfformatteddata_perfdisk_logicaldisk where Name='" & objItem.Name & "'") For Each objItem2 in colItems2 wscript.echo SItem & "Disk Time:" & EItem & SValue & objItem2.PercentDiskTime & "%" & EValue Next wscript.echo ETable Next wscript.quit |
Feel free to ping me with questions, criticisms, or rude comments.

