Save Date in variable after executed script

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
ALD Automotive
Posts: 11
Last visit: Thu Jun 01, 2023 4:52 am

Save Date in variable after executed script

Post by ALD Automotive »

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.156
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.14393.0

Hello,
Could you please let me know, is it possible save data inside variable after script executed (as simple Powershell).
For example i get in $data information from file and folders with big time executed. ( $data= ls \\server\sharefolder -recurcive ... ). I waste 15 min to collect $data and my next step working with this data (modify, copy, rename e.t.s.).
Question: How to save $data info? I don't want collect $data any time.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Save Date in variable after executed script

Post by Alexander Riedel »

I am not sure if that is a general "How to do this in PowerShell" question or a specific PowerShell Studio question.
For the latter, If you have a script where you need to examine variables *after* the script terminates to verify things, simply use "run in console".
You can then examine any variable your script created or modified. Be mindful though that repeated runs in the same console will not produce reliable results.
If this is a general question, save the content of your variable to a file and load it when executing it again. Only if the file does not already exists (or needs to be refreshed) you run your lengthy operation. But I would submit that files on a server probably change all the time :D
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 5 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.