TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Microsoft Windows Powershell

Notices

Reply
 
LinkBack Thread Tools Display Modes
Old 26-06-2008, 04:25 PM   #21
Matthew McDermott
Guest
 
Posts: n/a
Re: Scripted Installation with PowerShell

Shay,

I trimmed your transcript down to the essentials:

$server = "MOSS1"
$sqlroot = "\\$server\c$\mssql\"
$sqldata = "\data"
$sqllog = "\log"

$datapath = Join-Path -path $sqlroot $sqldata
$logpath = Join-Path -path $sqlroot $sqllog

mkdir $sqlroot
mkdir $datapath
mkdir $logpath


$sqlExec = "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe"
& $sqlExec -S $server -i c:\posh\DB_Create_Script.txt

....and it works. Thanks, I don't see what is different, but I appreciate
everyones efforts!

BTW, This is all on one box. No remote access. The only other possability is
that all my variables are stored in a seperate script file that I dot source.

Thannks again all.

--
Matthew McDermott, MVP
Principal Consultant
Catapult Systems, Inc.


"Shay Levi" wrote:

>
> Matthew ,
>
> I used v1. Just for the testings, can you run the same commands I executed
> and see if any errors arise?
> Are you running sqlcmd against a remote server or from a local context?
>
>
> ---
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
> > I am using version 1. Should I be using version 2?
> >
> > "Marco Shaw [MVP]" wrote:
> >
> >> Matthew McDermott wrote:
> >>
> >>> Shay,
> >>>
> >>> So it worked for you without error?
> >>>
> >>> Is there some permission that I am missing? I am not clear on how to
> >>> proceed...
> >>>
> >> So version check ya'll...
> >>
> >> PowerShell's handling of DOS commands was planned to slightly change
> >> in v2.
> >>
> >> I couldn't tell you if anything has been changed as of CTP2 though.
> >>
> >> Marco
> >>
> >> --
> >> Microsoft MVP - Windows PowerShell
> >> http://www.microsoft.com/mvp
> >> PowerGadgets MVP
> >> http://www.powergadgets.com/mvp
> >> Blog:
> >> http://marcoshaw.blogspot.com

>
>
>

  Reply With Quote
Old 26-06-2008, 04:25 PM   #22
Shay Levi
Guest
 
Posts: n/a
Re: Scripted Installation with PowerShell


When dot-sourced, your variables become global variables (available to multiple
scopes). The varaibles also remain active even after the script ends, so
I don't think this can be the cause to the problem. But hey, it works for
you now


---
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

MM> Shay,
MM>
MM> I trimmed your transcript down to the essentials:
MM>
MM> $server = "MOSS1"
MM> $sqlroot = "\\$server\c$\mssql\"
MM> $sqldata = "\data"
MM> $sqllog = "\log"
MM> $datapath = Join-Path -path $sqlroot $sqldata
MM> $logpath = Join-Path -path $sqlroot $sqllog
MM> mkdir $sqlroot
MM> mkdir $datapath
MM> mkdir $logpath
MM> $sqlExec = "C:\Program Files\Microsoft SQL
MM> Server\90\Tools\Binn\sqlcmd.exe" & $sqlExec -S $server -i
MM> c:\posh\DB_Create_Script.txt
MM>
MM> ...and it works. Thanks, I don't see what is different, but I
MM> appreciate everyones efforts!
MM>
MM> BTW, This is all on one box. No remote access. The only other
MM> possability is that all my variables are stored in a seperate script
MM> file that I dot source.
MM>
MM> Thannks again all.
MM>
MM> "Shay Levi" wrote:
MM>
>> Matthew ,
>>
>> I used v1. Just for the testings, can you run the same commands I
>> executed
>> and see if any errors arise?
>> Are you running sqlcmd against a remote server or from a local
>> context?
>> ---
>> Shay Levi
>> $cript Fanatic
>> http://scriptolog.blogspot.com
>>> I am using version 1. Should I be using version 2?
>>>
>>> "Marco Shaw [MVP]" wrote:
>>>
>>>> Matthew McDermott wrote:
>>>>
>>>>> Shay,
>>>>>
>>>>> So it worked for you without error?
>>>>>
>>>>> Is there some permission that I am missing? I am not clear on how
>>>>> to proceed...
>>>>>
>>>> So version check ya'll...
>>>>
>>>> PowerShell's handling of DOS commands was planned to slightly
>>>> change in v2.
>>>>
>>>> I couldn't tell you if anything has been changed as of CTP2 though.
>>>>
>>>> Marco
>>>>
>>>> --
>>>> Microsoft MVP - Windows PowerShell
>>>> http://www.microsoft.com/mvp
>>>> PowerGadgets MVP
>>>> http://www.powergadgets.com/mvp
>>>> Blog:
>>>> http://marcoshaw.blogspot.com



  Reply With Quote
Reply

Thread Tools
Display Modes


Google
 


All times are GMT +5.5. The time now is 05:17 PM.


vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2008, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional