Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - run different scripts

Reply
 
Old 03-07-2007   #1 (permalink)
frank


 
 

run different scripts

how do I run different script at the same tiime

example from cmd line I what type in test.cmd
and it will run

test1.ps1, test2,ps1, and test3.ps1

My System SpecsSystem Spec
Old 03-07-2007   #2 (permalink)
Brandon Shell


 
 

Re: run different scripts

You will need to path your scripts.
PS> "test1.ps1","test2.ps1","test3.ps1" | %{invoke-expression "& $_"}
--
Brandon Shell
---------------
Stop by my blog some time
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------

"frank" <frank@discussions.microsoft.com> wrote in message
news:67D8EFCE-93CE-4B17-916D-90A8EF243BD0@microsoft.com...
> how do I run different script at the same tiime
>
> example from cmd line I what type in test.cmd
> and it will run
>
> test1.ps1, test2,ps1, and test3.ps1


My System SpecsSystem Spec
Old 03-07-2007   #3 (permalink)
frank


 
 

Re: run different scripts

Thanks Bradon but I want run from cmd propt I iusualy need user running these
script and i do not want to go into powershell


so , if can let me know how to do that I will greatful

Frank



"Brandon Shell" wrote:

> You will need to path your scripts.
> PS> "test1.ps1","test2.ps1","test3.ps1" | %{invoke-expression "& $_"}
> --
> Brandon Shell
> ---------------
> Stop by my blog some time
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
> --------------------------------------
>
> "frank" <frank@discussions.microsoft.com> wrote in message
> news:67D8EFCE-93CE-4B17-916D-90A8EF243BD0@microsoft.com...
> > how do I run different script at the same tiime
> >
> > example from cmd line I what type in test.cmd
> > and it will run
> >
> > test1.ps1, test2,ps1, and test3.ps1

>
>

My System SpecsSystem Spec
Old 03-07-2007   #4 (permalink)
Brandon Shell


 
 

Re: run different scripts

Thats a little more complicated do to the way command prompt processes the
command.

Why do you not want them to run powershell? It would seem they are
comfortable with Command Shell. Just curious to the logic.
--
Brandon Shell
---------------
Stop by my blog some time
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------

"frank" <frank@discussions.microsoft.com> wrote in message
news:383898BA-E563-4F24-AA8C-44806BA0BF87@microsoft.com...
> Thanks Bradon but I want run from cmd propt I iusualy need user running
> these
> script and i do not want to go into powershell
>
>
> so , if can let me know how to do that I will greatful
>
> Frank
>
>
>
> "Brandon Shell" wrote:
>
>> You will need to path your scripts.
>> PS> "test1.ps1","test2.ps1","test3.ps1" | %{invoke-expression "& $_"}
>> --
>> Brandon Shell
>> ---------------
>> Stop by my blog some time
>> Blog: http://www.bsonposh.com/
>> PSH Scripts Project: www.codeplex.com/psobject
>> --------------------------------------
>>
>> "frank" <frank@discussions.microsoft.com> wrote in message
>> news:67D8EFCE-93CE-4B17-916D-90A8EF243BD0@microsoft.com...
>> > how do I run different script at the same tiime
>> >
>> > example from cmd line I what type in test.cmd
>> > and it will run
>> >
>> > test1.ps1, test2,ps1, and test3.ps1

>>
>>


My System SpecsSystem Spec
Old 03-07-2007   #5 (permalink)
frank


 
 

Re: run different scripts

this a users they want as simple as possible they just run a batch file and
it will be done

they do not what to launch powershell, then type in a long command line



"Brandon Shell" wrote:

> Thats a little more complicated do to the way command prompt processes the
> command.
>
> Why do you not want them to run powershell? It would seem they are
> comfortable with Command Shell. Just curious to the logic.
> --
> Brandon Shell
> ---------------
> Stop by my blog some time
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
> --------------------------------------
>
> "frank" <frank@discussions.microsoft.com> wrote in message
> news:383898BA-E563-4F24-AA8C-44806BA0BF87@microsoft.com...
> > Thanks Bradon but I want run from cmd propt I iusualy need user running
> > these
> > script and i do not want to go into powershell
> >
> >
> > so , if can let me know how to do that I will greatful
> >
> > Frank
> >
> >
> >
> > "Brandon Shell" wrote:
> >
> >> You will need to path your scripts.
> >> PS> "test1.ps1","test2.ps1","test3.ps1" | %{invoke-expression "& $_"}
> >> --
> >> Brandon Shell
> >> ---------------
> >> Stop by my blog some time
> >> Blog: http://www.bsonposh.com/
> >> PSH Scripts Project: www.codeplex.com/psobject
> >> --------------------------------------
> >>
> >> "frank" <frank@discussions.microsoft.com> wrote in message
> >> news:67D8EFCE-93CE-4B17-916D-90A8EF243BD0@microsoft.com...
> >> > how do I run different script at the same tiime
> >> >
> >> > example from cmd line I what type in test.cmd
> >> > and it will run
> >> >
> >> > test1.ps1, test2,ps1, and test3.ps1
> >>
> >>

>
>

My System SpecsSystem Spec
Old 03-07-2007   #6 (permalink)
Brandon Shell


 
 

Re: run different scripts

are they set scripts? meaning does the user specify which ones to run or do
you just hard code it?

--
Brandon Shell
---------------
Stop by my blog some time
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------

"frank" <frank@discussions.microsoft.com> wrote in message
news067AEA3-CF84-4274-A35A-86D9D37A48D8@microsoft.com...
> this a users they want as simple as possible they just run a batch file
> and
> it will be done
>
> they do not what to launch powershell, then type in a long command line
>
>
>
> "Brandon Shell" wrote:
>
>> Thats a little more complicated do to the way command prompt processes
>> the
>> command.
>>
>> Why do you not want them to run powershell? It would seem they are
>> comfortable with Command Shell. Just curious to the logic.
>> --
>> Brandon Shell
>> ---------------
>> Stop by my blog some time
>> Blog: http://www.bsonposh.com/
>> PSH Scripts Project: www.codeplex.com/psobject
>> --------------------------------------
>>
>> "frank" <frank@discussions.microsoft.com> wrote in message
>> news:383898BA-E563-4F24-AA8C-44806BA0BF87@microsoft.com...
>> > Thanks Bradon but I want run from cmd propt I iusualy need user running
>> > these
>> > script and i do not want to go into powershell
>> >
>> >
>> > so , if can let me know how to do that I will greatful
>> >
>> > Frank
>> >
>> >
>> >
>> > "Brandon Shell" wrote:
>> >
>> >> You will need to path your scripts.
>> >> PS> "test1.ps1","test2.ps1","test3.ps1" | %{invoke-expression "& $_"}
>> >> --
>> >> Brandon Shell
>> >> ---------------
>> >> Stop by my blog some time
>> >> Blog: http://www.bsonposh.com/
>> >> PSH Scripts Project: www.codeplex.com/psobject
>> >> --------------------------------------
>> >>
>> >> "frank" <frank@discussions.microsoft.com> wrote in message
>> >> news:67D8EFCE-93CE-4B17-916D-90A8EF243BD0@microsoft.com...
>> >> > how do I run different script at the same tiime
>> >> >
>> >> > example from cmd line I what type in test.cmd
>> >> > and it will run
>> >> >
>> >> > test1.ps1, test2,ps1, and test3.ps1
>> >>
>> >>

>>
>>


My System SpecsSystem Spec
Old 03-07-2007   #7 (permalink)
frank


 
 

Re: run different scripts

well this goes back to my local user question I want the user to type in

newuser.cmd username password

this will call .$pwd/user.ps1
then it will run adduser.ps1 user name and password specified above
then it run addtogroup.ps1 which add the user specified above to a hard
coded group
finnaly it runs folder.ps1 which creates a sub folder under d:\ftp the
folder will be the same name as username so it will get that information from
above


thanks


Frank

"Brandon Shell" wrote:

> are they set scripts? meaning does the user specify which ones to run or do
> you just hard code it?
>
> --
> Brandon Shell
> ---------------
> Stop by my blog some time
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
> --------------------------------------
>
> "frank" <frank@discussions.microsoft.com> wrote in message
> news067AEA3-CF84-4274-A35A-86D9D37A48D8@microsoft.com...
> > this a users they want as simple as possible they just run a batch file
> > and
> > it will be done
> >
> > they do not what to launch powershell, then type in a long command line
> >
> >
> >
> > "Brandon Shell" wrote:
> >
> >> Thats a little more complicated do to the way command prompt processes
> >> the
> >> command.
> >>
> >> Why do you not want them to run powershell? It would seem they are
> >> comfortable with Command Shell. Just curious to the logic.
> >> --
> >> Brandon Shell
> >> ---------------
> >> Stop by my blog some time
> >> Blog: http://www.bsonposh.com/
> >> PSH Scripts Project: www.codeplex.com/psobject
> >> --------------------------------------
> >>
> >> "frank" <frank@discussions.microsoft.com> wrote in message
> >> news:383898BA-E563-4F24-AA8C-44806BA0BF87@microsoft.com...
> >> > Thanks Bradon but I want run from cmd propt I iusualy need user running
> >> > these
> >> > script and i do not want to go into powershell
> >> >
> >> >
> >> > so , if can let me know how to do that I will greatful
> >> >
> >> > Frank
> >> >
> >> >
> >> >
> >> > "Brandon Shell" wrote:
> >> >
> >> >> You will need to path your scripts.
> >> >> PS> "test1.ps1","test2.ps1","test3.ps1" | %{invoke-expression "& $_"}
> >> >> --
> >> >> Brandon Shell
> >> >> ---------------
> >> >> Stop by my blog some time
> >> >> Blog: http://www.bsonposh.com/
> >> >> PSH Scripts Project: www.codeplex.com/psobject
> >> >> --------------------------------------
> >> >>
> >> >> "frank" <frank@discussions.microsoft.com> wrote in message
> >> >> news:67D8EFCE-93CE-4B17-916D-90A8EF243BD0@microsoft.com...
> >> >> > how do I run different script at the same tiime
> >> >> >
> >> >> > example from cmd line I what type in test.cmd
> >> >> > and it will run
> >> >> >
> >> >> > test1.ps1, test2,ps1, and test3.ps1
> >> >>
> >> >>
> >>
> >>

>
>

My System SpecsSystem Spec
Old 03-07-2007   #8 (permalink)
Brandon Shell


 
 

Re: run different scripts

Create a master script and cut/paste this.
1) Remember to add your folder code.
2) Remember to Insert the group name in the script

Then Change your Batch file from
powershell -noprofile pathtoscript\add-user.ps1 -user %1 -password %2
to
powershell -noprofile pathtoscript\master.ps1 -user %1 -password %2

---------------------------
param([string]$user,[string]$password)

If(!($server)){$server = get-content env:COMPUTERNAME}
$srv = [ADSI]("WinNT://$server,computer")
$newuser = $srv.psbase.children.add("$user","user")
$newuser.psbase.invoke("SetPassword",$password)
$newuser.psbase.CommitChanges()

# $group = "<INSERT GROUP NAME HERE AND REMOVE #>"

Write-Host ""
Write-Host "Adding User [$user] to group [$group]"
Write-Host
$ary = @()
$u = [ADSI]("WinNT://$server/$User,User")
$ary += $u.psbase.path

# Getting Group and Adding User
$g = [ADSI]("WinNT://$server/$group,group")
$g.psbase.invoke("add",$ary)
Write-Host "If no Exception... User Added" -ForegroundColor Green

### ADD FOLDER CODE HERE ###

--
Brandon Shell
---------------
Stop by my blog some time
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------

"frank" <frank@discussions.microsoft.com> wrote in message
news1EC680B-92BB-4BEA-8CD2-219C71FEF2BA@microsoft.com...
> well this goes back to my local user question I want the user to type in
>
> newuser.cmd username password
>
> this will call .$pwd/user.ps1
> then it will run adduser.ps1 user name and password specified above
> then it run addtogroup.ps1 which add the user specified above to a hard
> coded group
> finnaly it runs folder.ps1 which creates a sub folder under d:\ftp the
> folder will be the same name as username so it will get that information
> from
> above
>
>
> thanks
>
>
> Frank
>
> "Brandon Shell" wrote:
>
>> are they set scripts? meaning does the user specify which ones to run or
>> do
>> you just hard code it?
>>
>> --
>> Brandon Shell
>> ---------------
>> Stop by my blog some time
>> Blog: http://www.bsonposh.com/
>> PSH Scripts Project: www.codeplex.com/psobject
>> --------------------------------------
>>
>> "frank" <frank@discussions.microsoft.com> wrote in message
>> news067AEA3-CF84-4274-A35A-86D9D37A48D8@microsoft.com...
>> > this a users they want as simple as possible they just run a batch file
>> > and
>> > it will be done
>> >
>> > they do not what to launch powershell, then type in a long command line
>> >
>> >
>> >
>> > "Brandon Shell" wrote:
>> >
>> >> Thats a little more complicated do to the way command prompt processes
>> >> the
>> >> command.
>> >>
>> >> Why do you not want them to run powershell? It would seem they are
>> >> comfortable with Command Shell. Just curious to the logic.
>> >> --
>> >> Brandon Shell
>> >> ---------------
>> >> Stop by my blog some time
>> >> Blog: http://www.bsonposh.com/
>> >> PSH Scripts Project: www.codeplex.com/psobject
>> >> --------------------------------------
>> >>
>> >> "frank" <frank@discussions.microsoft.com> wrote in message
>> >> news:383898BA-E563-4F24-AA8C-44806BA0BF87@microsoft.com...
>> >> > Thanks Bradon but I want run from cmd propt I iusualy need user
>> >> > running
>> >> > these
>> >> > script and i do not want to go into powershell
>> >> >
>> >> >
>> >> > so , if can let me know how to do that I will greatful
>> >> >
>> >> > Frank
>> >> >
>> >> >
>> >> >
>> >> > "Brandon Shell" wrote:
>> >> >
>> >> >> You will need to path your scripts.
>> >> >> PS> "test1.ps1","test2.ps1","test3.ps1" | %{invoke-expression "&
>> >> >> $_"}
>> >> >> --
>> >> >> Brandon Shell
>> >> >> ---------------
>> >> >> Stop by my blog some time
>> >> >> Blog: http://www.bsonposh.com/
>> >> >> PSH Scripts Project: www.codeplex.com/psobject
>> >> >> --------------------------------------
>> >> >>
>> >> >> "frank" <frank@discussions.microsoft.com> wrote in message
>> >> >> news:67D8EFCE-93CE-4B17-916D-90A8EF243BD0@microsoft.com...
>> >> >> > how do I run different script at the same tiime
>> >> >> >
>> >> >> > example from cmd line I what type in test.cmd
>> >> >> > and it will run
>> >> >> >
>> >> >> > test1.ps1, test2,ps1, and test3.ps1
>> >> >>
>> >> >>
>> >>
>> >>

>>
>>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
run .cmd scripts on remote machine (automating the MOSS install via scripts) PowerShell
Sql scripts PowerShell
Scripts Vista mail
PS scripts -> VBS PowerShell
UAC and scripts (.wsf) Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46