Sunday, February 19, 2012

Create Directory in Instance Sql Server of another machine

My Sql Server is in Windows Server 2003 machine the name: Machine1

I want create a new directory in machine1 over in machine2 (my machine)

The code is:

Dim srv As New Server("SqlInstance")

Dim sFolder As String = srv.Settings.DefaultFile & "\NewDirectory"

IO.Directory.CreateDirectory(sFolder)

This not work because the sFolder report = D:\SqlData\NewDirectory and the Io.Directory try create in my local machine (I not have a drive D:\ in machine local).

How can I create a subdirectory in srv.settings.defaulfile Sql Server?

thanks,

Marsenne

Hi,

do you want to create a folder on a remote machine ?

you can either use a share to create this file (an administrative share perhpas, if you have the appropiate permissions:

System.IO.Directory.CreateDirectory(@.\\m2-jenss\hierrein\Test);

Or you can use WMI to create a folder on the remote machine:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_createfolderaction.asp

HTH, JEns Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment