Gerrit Mantel
Programs SQL_STORED_PROCEDURE - prc_ps_computersystem

Main program

Nameprc_ps_computersystem
Type_descSQL_STORED_PROCEDURE
CommentSQLServer Stored Procedure

PURPOSE
List properties of the local Computer System.

Field list:
- Name VARCHAR(128) NOT NULL (PK)
- Manufacturer VARCHAR(128) NULL
- Model VARCHAR(128) NULL
- NumberOfProcessors INT NULL
- NumberOfLogicalProcessors INT NULL
- TotalPhysicalMemory BIGINT NULL

This procedure uses the following method:
- Create Powershell script on Windows temp folder
- Run the Powershell script (with xp_cmdshell) and output results to csv-file to Windows temp folder
- Use BULK INSERT to load the csv-file into a temp table
- Select results from the temp table

EXAMPLES
EXEC [dbo].[prc_ps_computersystem];

USED OBJECTS
- xp_cmdshell (extended stored procedure) (*)
- powershell (external program)
- dbo.prc_save_text_to_file (SP in local database) (**)
- dbo.fun_FolderExist (UDF in local database) (**)
- dbo.fun_DeleteFile (UDF in local database) (**)
- dbo.fun_FileExist (UDF in local database) (**)
- dbo.fun_TempFolder (UDF in local database) (**)

(*) - Needs config parameter 'xp_cmdshell' = 1
(**) - Needs config parameter 'Ole Automation Procedures' = 1

HISTORY
2026-01-24 - Created procedure
2026-03-07 - Use UDF dbo.fun_TempFolder to get Windows temp folder

TAGS
<program>
<description>List properties of the local Computer System</description>
<generic>1</generic>
<author>Gerrit Mantel</author>
<created>2026-01-24</created>
<lastmodified>2026-03-07</lastmodified>
</program>
DescriptionList properties of the local Computer System
Minversion
Generic1
AuthorGerrit Mantel
Created2026-01-24 00:00:00
Lastmodified2026-03-07 00:00:00
Xp_cmdshell1
Ole_automation0
Subprogram_cnt5
Sourcecode

Sub programs

NameType descDescriptionMinversionGenericAuthorCreatedLastmodifiedXp cmdshellOle automation
fun_DeleteFileSQL_SCALAR_FUNCTIONDelete given file(s)1Gerrit Mantel2017-10-10 00:00:002026-01-23 00:00:0001
fun_FileExistSQL_SCALAR_FUNCTIONCheck if file exists1Gerrit Mantel2015-11-24 00:00:002026-01-23 00:00:0001
fun_FolderExistSQL_SCALAR_FUNCTIONCheck if folder exists1Gerrit Mantel2015-11-24 00:00:002026-01-23 00:00:0001
fun_TempFolderSQL_SCALAR_FUNCTIONGet Windows temp folder directory1Gerrit Mantel2026-03-07 00:00:002026-03-07 00:00:0001
prc_save_text_to_fileSQL_STORED_PROCEDUREWrite text variable to ansi file1Gerrit Mantel2017-01-25 00:00:002025-06-06 00:00:0001