I want to build a DashBoard GUI for our data migration project from 7 to 10 that I’ll need to analyze different servers (unc paths). It all relies on returning the results of a parent folder, a single txt file nested directly inside the Parent folder and a string inside a Logs folder nested inside the parent
My query begins with the below code to list all the folders on the Server share
Get-childitem \\server\users\*
This would return folders with usernames as you all know
AdamsJ12
BrownR1
DoeJ3
DoeJ4
(there are currently 200 active profiles but this number will increase to thousands before March)
Inside those folders, we create 2 folders (data, logs)and a txt file so a full name of one of the txt file I want is
\\server\users\brownr1\Success.txt
So the parent is brownr1
The GUI displays:
Textboxes to show count of migrations that are, currently in a wait state (success), a failed state, or a synching State
A DGV to display
The username and folder(s) it failed (this could be multiple folders if for example the user is working on a file from their desktop and documents, or they are encrypted), lastwritetime, createdtime
Be able to click on a DGV row and open to (Invoke-Item) the selected user folder for further inspection if needed
Being able to see these will help me track down issues and fix for the next release of the application and will also show the grand scheme to the bosses
I know it’s a lot, but it’s simple at the same time
Parent Folder
Txt File
String from a txt file nested in a Logs folder
I should be able to figure out the GUI if I can pull these three items
Get-ChildItem list txt file and more!
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- apowershelluser
- Posts: 191
- Last visit: Tue Mar 19, 2024 6:32 am
Re: Get-ChildItem list txt file and more!
This is a good learning project for both PowerShell and PowerShell Studio.
Start by designing you form. Add the code required to the form events.
To learn how to use PowerShell with forms start with the Sapien InfoCenter here: https://info.sapien.com/index.php/guis
There are numerous videos on YouTube for PSS use.
Start by designing you form. Add the code required to the form events.
To learn how to use PowerShell with forms start with the Sapien InfoCenter here: https://info.sapien.com/index.php/guis
There are numerous videos on YouTube for PSS use.
- apowershelluser
- Posts: 191
- Last visit: Tue Mar 19, 2024 6:32 am
Re: Get-ChildItem list txt file and more!
Thanks for replying. I think I can do the GUI, it’s just returning those three items. I can pull them individually and if needed, that’s what I’d do but query the server three different times isn’t what I’m looking to do.
Any help with an example of returning the parent folder and a sub txt file would get this project going
Any help with an example of returning the parent folder and a sub txt file would get this project going
Re: Get-ChildItem list txt file and more!
So you are not asking about a form but how to query a folder on a server for a file in multiple locations.
Just use a wild card.
Get-ChildItem \\server\users\*\Success.txt -recurse
Just use a wild card.
Get-ChildItem \\server\users\*\Success.txt -recurse
- apowershelluser
- Posts: 191
- Last visit: Tue Mar 19, 2024 6:32 am
Re: Get-ChildItem list txt file and more!
Hello,
So I was absolutely overthinking this when I realized that I was going about this the wrong way.
To get what I need, successes, failures, synching where all within an easy query. There is a file that is named failed, synching, success. Duh!
Now I just query the server with get-childitem \\server\users to fill a grid, then use | where-object on the files to fill in textboxes with total counts of the project the bosses need to know.
Then use a radiobutton and regular button to list those specific folders in the grid - see 2nd to last paragraph for my question...
I found the template for Job Grid ( or whatever it’s called ) which is perfect all but one item. My grid current is just the folder name so
\\server\users\user1
\\server\users\user2
etc...
What I’d like to do is click on the row and invoke-item and open Windows Explorer to the selected text which is the directory. I’ve read about how to click on a row and something happens but no examples of opening a directory.
Work-On:
2nd column is to read a file inside the \Logs directory and list the reason it failed. There’s multiple reasons in different files so that will be a pain but it’s not needed for the project currently.
So I was absolutely overthinking this when I realized that I was going about this the wrong way.
To get what I need, successes, failures, synching where all within an easy query. There is a file that is named failed, synching, success. Duh!
Now I just query the server with get-childitem \\server\users to fill a grid, then use | where-object on the files to fill in textboxes with total counts of the project the bosses need to know.
Then use a radiobutton and regular button to list those specific folders in the grid - see 2nd to last paragraph for my question...
I found the template for Job Grid ( or whatever it’s called ) which is perfect all but one item. My grid current is just the folder name so
\\server\users\user1
\\server\users\user2
etc...
What I’d like to do is click on the row and invoke-item and open Windows Explorer to the selected text which is the directory. I’ve read about how to click on a row and something happens but no examples of opening a directory.
Work-On:
2nd column is to read a file inside the \Logs directory and list the reason it failed. There’s multiple reasons in different files so that will be a pain but it’s not needed for the project currently.
Re: Get-ChildItem list txt file and more!
I am sorry but I cannot make any sense out of what you are trying to ask.
Please be aware that technical forums are for answering specific technical questions. Designing solutions or teaching you PowerSHell or Windows Forms is beyond the scope of any technical forum.
Can you just as one question and show the code you have used that presents the problem or cause an error.
Please be aware that technical forums are for answering specific technical questions. Designing solutions or teaching you PowerSHell or Windows Forms is beyond the scope of any technical forum.
Can you just as one question and show the code you have used that presents the problem or cause an error.
- apowershelluser
- Posts: 191
- Last visit: Tue Mar 19, 2024 6:32 am
Re: Get-ChildItem list txt file and more!
There’s no error. I just don’t know what to write inside the click event. I’ve researched this topic for the last few days to no avail, hence why I’m asking here.
What I’d like to do is double click a row of the datagridview and it opens to a Windows Explorer window. The row text is just the name and location of the server.
So if a row is
\\server\users\john
I click on it and a Windows Explorer dialog opens to that directory.
What I’d like to do is double click a row of the datagridview and it opens to a Windows Explorer window. The row text is just the name and location of the server.
So if a row is
\\server\users\john
I click on it and a Windows Explorer dialog opens to that directory.
- apowershelluser
- Posts: 191
- Last visit: Tue Mar 19, 2024 6:32 am
Re: Get-ChildItem list txt file and more!
I’m mobile but I’m thinking this might get me where I want to go
$datagridview1_SelectionChanged={
$r=$datagridview1.SelectedRows[0].Cells[0].Value
[void][System.Windows.Forms.MessageBox]::Show($r,"test")
}
I’ll post back in a few days
$datagridview1_SelectionChanged={
$r=$datagridview1.SelectedRows[0].Cells[0].Value
[void][System.Windows.Forms.MessageBox]::Show($r,"test")
}
I’ll post back in a few days
- apowershelluser
- Posts: 191
- Last visit: Tue Mar 19, 2024 6:32 am
Re: Get-ChildItem list txt file and more!
$datagridview1_Click={
#TODO: Place custom script here
Invoke-Item $datagridview1.SelectedCells[0].FormattedValue
}
This was what I meant to post. Now more digging for other items as I can mark this one off the list