![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Taking ownership of script members? I have a script called getMyXmlFromDB.ps1 which retrieves some xml data from an sqlxml website - it works well, but I'd also like to be able to manipulate the dom object after the script has run - my guess is that the dom is being destroyed when the script finishes as it goes out of scope or something. Can I instruct the shell to inherit the data/objects of the running script? Thanks, Duncan. Here's the script: --- #.\getMyXmlFromDB.ps1 "running getMyXmlFromDB.ps1" # get data from the database into a DOM $friStr = "<root>" $friStr += Get-url "http://barsql01/mydatabase?sql=exec GetMyData_sp @p_strEvent='EvCode', @p_strSeason='2007', @p_strMinTime='2007-03-15 00:00:00', @p_strMaxTime='2007-03-16 23:59:59'" $friStr += "</root>" [xml]$friXml = $friStr echo $friXml # pretty-print and write to a file fxml -InputObject $fri > fri.xml --- |
| | #2 (permalink) |
| Guest | Re: Taking ownership of script members? you can dot source the script to load it into the global (interactive) scope : .. .\getMyXmlFromDB.ps1 note the dot and space before the scriptpath Greetings /\/\o\/\/ "Duncan Smith" <DSmith1974@googlemail.com> wrote in message news:1174580108.193401.44640@n76g2000hsh.googlegroups.com... >I have a script called getMyXmlFromDB.ps1 which retrieves some xml > data from an sqlxml website - it works well, but I'd also like to be > able to manipulate the dom object after the script has run - my guess > is that the dom is being destroyed when the script finishes as it goes > out of scope or something. > > Can I instruct the shell to inherit the data/objects of the running > script? > > Thanks, > > Duncan. > > Here's the script: > > --- > #.\getMyXmlFromDB.ps1 > > "running getMyXmlFromDB.ps1" > > # get data from the database into a DOM > $friStr = "<root>" > $friStr += Get-url "http://barsql01/mydatabase?sql=exec GetMyData_sp > @p_strEvent='EvCode', @p_strSeason='2007', @p_strMinTime='2007-03-15 > 00:00:00', @p_strMaxTime='2007-03-16 23:59:59'" > $friStr += "</root>" > > [xml]$friXml = $friStr > > echo $friXml > > # pretty-print and write to a file > fxml -InputObject $fri > fri.xml > --- > |
| | #3 (permalink) |
| Guest | Re: Taking ownership of script members? On Mar 22, 5:58 pm, "/\\/\\o\\/\\/ [MVP]" <mow...@hotmail.NoSpam> wrote: > you can dot source the script to load it into the global (interactive) scope > : > > . .\getMyXmlFromDB.ps1 > > note the dot and space before the scriptpath > > Greetings /\/\o\/\/ > > "Duncan Smith" <DSmith1...@googlemail.com> wrote in message > > news:1174580108.193401.44640@n76g2000hsh.googlegroups.com... > > >I have a script called getMyXmlFromDB.ps1 which retrieves some xml > > data from an sqlxml website - it works well, but I'd also like to be > > able to manipulate the dom object after the script has run - my guess > > is that the dom is being destroyed when the script finishes as it goes > > out of scope or something. > > > Can I instruct the shell to inherit the data/objects of the running > > script? > > > Thanks, > > > Duncan. > > > Here's the script: > > > --- > > #.\getMyXmlFromDB.ps1 > > > "running getMyXmlFromDB.ps1" > > > # get data from the database into a DOM > > $friStr = "<root>" > > $friStr += Get-url "http://barsql01/mydatabase?sql=execGetMyData_sp > > @p_strEvent='EvCode', @p_strSeason='2007', @p_strMinTime='2007-03-15 > > 00:00:00', @p_strMaxTime='2007-03-16 23:59:59'" > > $friStr += "</root>" > > > [xml]$friXml = $friStr > > > echo $friXml > > > # pretty-print and write to a file > > fxml -InputObject $fri > fri.xml > > --- That's great, thanks :-) |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Taking Ownership | KingOfChaos | General Discussion | 1 | 04-08-2008 02:12 PM |
| Taking Ownership of a 2nd Hard Drive | Rohan | Vista security | 1 | 12-09-2007 04:35 AM |
| taking ownership of system 32 files | maxvista | Vista General | 3 | 12-02-2007 04:36 PM |
| What would the effect be of taking ownership of a drive? | JD | Vista account administration | 3 | 11-14-2006 09:01 PM |
| Taking Ownership? | Paula | Vista General | 39 | 09-10-2006 02:46 PM |