The EnterpriseOne Microsoft category will include all posts and pages pertaining to Microsoft products in an EnterpriseOne installation.

Recover Lost Disk Space

We currently share development clients and so there can be many people that use each one. Several times some of those clients have filled their C: drives and I have been unable to find where it went. I checked user desktops, downloads, etc. However, I was unable to find anything.

Then, I ran across a simple command that can empty the recycle bins of every user on the PC and help you recover your lost disk space:

rd /s /q "C:\$Recycle.Bin"

Hopefully, writing this little tip here will help me remember and maybe help someone else that has lost disk space and doesn’t know where it went.

How To List The Column Names Of A Table On SQL Server

We all know that most database tables in EnterpriseOne have a large number of columns. In fact, they usually push the limits of the RDBMS.

Well sometimes, you need a list of those columns for things like INSERT statements.

Below is how you can get the column names from a table in a SQL Server database:

SELECT [name] AS [Column Name]
FROM syscolumns
WHERE id = (SELECT id FROM sysobjects WHERE type = 'U' AND [Name] = 'F98950')

You can use either type V (views) or U (tables).

Check Windows Service Status And Restart If Necessary

Lately we have been noticing an issue where the Print Spooler service stops for some reason and users are unable to print UBE results through EnterpriseOne. So far, we have been unable to narrow down a cause for the Spooler service to stop.

So, like any good CNC Admin, I put a band-aid on it. I found a bat file script that I could use to check the status of the service and then restart the service it it wasn’t running. I then setup a scheduled task to run every 5 minutes.

for /F "tokens=3 delims=: " %%H in ('sc query "Spooler" ^| findstr " STATE"') do (
if /I "%%H" NEQ "RUNNING" (
 REM Put your code you want to execute here
 REM For example, the following line
 net start "Spooler"
 ECHO Spooler has been restarted

Do you have any band-aids that you use to mitigate issues?

Safely Delete Files From WINSXS

We started to run out of disk space on one of our production Windows Enterprise servers. This usually isn’t a huge deal with virtual machines, however this was on the c drive. Yes, I know those can be expanded too, however I wanted to do a little investigating before I just started dumping disk space to it.

I found that there were over 12 GB taken up by the c:\windows\winsxs directory. I did some checking around the internet and found a blog post (Clean up Winsxs on Windows 2008 R2 after SP1 install) that provided me with a way to cleanup the WINSXS directory in a way that was supported by Microsoft:

DISM.exe /online /Cleanup-Image /spsuperseded

Now, it didn’t totally clear out the directory, but it did reduced it down to only 5 GB.

How To Find The Physical Size Of SQL Server Tables And Indexes

Inspired by Shannon’s post (give me the size of data and indexes for a file in an oracle database please), I found a SQL statement that finds the size of each table and index in a SQL Server database. I also found that there are a ton of different ways to get this information. Below is the method that I is most beneficial to me:

EXEC sp_spaceused

DECLARE @spaceUsed TABLE (
 name varchar(255), 
 rows int, 
 reserved varchar(50), 
 data varchar(50), 
 index_size varchar(50), 
 unused varchar(50))

INSERT INTO @spaceUsed
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"

SELECT name, rows, left(reserved,len(reserved)-3) as [reserved (KB)], 
	left(data,len(data)-3) as [data (KB)], 
	left(index_size,len(index_size)-3) as [index_size (KB)], 
	left(unused,len(unused)-3) as [unused (KB)]
FROM @spaceUsed
order by rows desc