Re: Save as in SQL Server(Backup - Restore)

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 09/30/04


Date: Thu, 30 Sep 2004 08:39:22 -0500

WMI - Windows Management Instrumentation. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_start_page.asp
for a reference. You can also find a lot of examples with a google search.

Option Explicit

Dim SQL, Results, ServerName
Dim oWin32_LogicalDisks, oWin32_LogicalDisk

ServerName = "MyServer"

'list local disks on remote server
SQL = "SELECT * FROM Win32_LogicalDisk WHERE DriveType = 3"

Set oWin32_LogicalDisks = _
    GetObject("winmgmts:{impersonationLevel=impersonate}!//" & _
    ServerName & _
    "/root/cimv2").ExecQuery(SQL, , 48)

For Each oWin32_LogicalDisk In oWin32_LogicalDisks
    Results = Results & _
        oWin32_LogicalDisk.Caption & _
        vbCrLf
Next

MsgBox(Results)

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"Lars Grøtteland" <lars@nospam> wrote in message 
news:eukWq$upEHA.3688@TK2MSFTNGP09.phx.gbl...
> WMI? What's that?
>
> -- 
>
>
> - Lars
>
>
> "Dan Guzman" <guzmanda@nospam-online.sbcglobal.net> wrote in message 
> news:%237FDQxupEHA.1576@TK2MSFTNGP12.phx.gbl...
>> Just be aware that undocumented functionality may change between SQL 
>> Server versions or service packs so it's a good practice to avoid this in 
>> production code.
>>
>> Another method to accomplish the task is with WMI.
>>
>> -- 
>> Hope this helps.
>>
>> Dan Guzman
>> SQL Server MVP
>>
>> "Lars Grøtteland" <lars@nospam> wrote in message 
>> news:%23hVB3gupEHA.3524@TK2MSFTNGP15.phx.gbl...
>>> xp_availablemedia 2 - That's the command I was looking for
>>>
>>> -- 
>>>
>>>
>>> - Lars
>>>
>>>
>>> "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote 
>>> in message news:emrrdOupEHA.644@tk2msftngp13.phx.gbl...
>>>> That is no problem. I take it you already know about the RESTORE 
>>>> command and the MOVE option to the
>>>> restore command.
>>>>
>>>> If you want the user to be able to browse the directory structure on 
>>>> the server through their SQL
>>>> Server connection, then you have to use some undocumented commands. Run 
>>>> a profiler trace to see how
>>>> EM gets the directory structure and use those commands in your own app. 
>>>> Note that they are
>>>> undocumented, use at your own risk...
>>>>
>>>> -- 
>>>> Tibor Karaszi, SQL Server MVP
>>>> http://www.karaszi.com/sqlserver/default.asp
>>>> http://www.solidqualitylearning.com/
>>>>
>>>>
>>>> "Lars Grøtteland" <lars@nospam> wrote in message 
>>>> news:Or3bY1rpEHA.592@TK2MSFTNGP11.phx.gbl...
>>>>> My problem is to get "Save As" in my application.
>>>>> Create a new database and restore one database into the created one, 
>>>>> and use
>>>>> the new one in my app.
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>>
>>>>>
>>>>> - Lars
>>>>>
>>>>>
>>>>> "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> 
>>>>> wrote in
>>>>> message news:u8RHZlipEHA.3724@TK2MSFTNGP10.phx.gbl...
>>>>> >> Are there any other way around this problem then?
>>>>> >
>>>>> > Can you explain what the problem is? First it seems you wanted to 
>>>>> > create
>>>>> > database files on a network
>>>>> > drive. You can't do that. Then you mentioned SQLNS, which has no
>>>>> > relationship with your original
>>>>> > problem...
>>>>> >
>>>>> > -- 
>>>>> > Tibor Karaszi, SQL Server MVP
>>>>> > http://www.karaszi.com/sqlserver/default.asp
>>>>> > http://www.solidqualitylearning.com/
>>>>> >
>>>>> >
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> 


Relevant Pages

  • Re: Monitoring and Alerts
    ... Stop and Disabled the WMI service. ... After this command is completed, start the WMI service and run this command ... |> Relay settings for Exchange SMTP Virtual Server: ... I didn't receive a performance alert. ...
    (microsoft.public.windows.server.sbs)
  • RE: Fulltext failure on a 2 node cluster
    ... Server full-text search resource online: "SQL Cluster Resource 'Full Text' ...
    (microsoft.public.sqlserver.clustering)
  • Re: HELP PLEASE ~ ???
    ... You mentioned that it went ahead and added a SQL ... SQL Server 2000 database for all my data. ... find the connectionString in the newly recreated SQLExpress database. ... The connection string specifies a local Sql Server Express instance ...
    (microsoft.public.dotnet.framework.aspnet)
  • IBM INFORMIX ODBC DRIVER 3.00.00.13223 - ICLIT09B.DLL EXCEPTION_AC
    ... then use a link server – Microsoft OLE DB Provider for ODBC Driver. ... and Linked server test connection successfully and I can return most records ... A severe error occurred on the current command. ... Here's my SQL and ERRORS ...
    (microsoft.public.sqlserver.odbc)
  • EXCEPTION_ACCESS_VIOLATION Error: 17310, Severity: 20, State: 1.
    ... then use a link server – Microsoft OLE DB Provider for ODBC Driver. ... and Linked server test connection successfully and I can return most records ... A severe error occurred on the current command. ... Here's my SQL and ERRORS ...
    (microsoft.public.sqlserver.datamining)