Download csv file (written in powershell) in user interface by stakeholders

Hi All,

I am new to powershell and so here.

Perhaps my question looks so ease for the experts but still I need your help.

I have a below script from the following link : https://support.microsoft.com/en-us/office/export-yammer-group-members-to-a-csv-file-201a78fd-67b8-42c3-9247-79e79f92b535

whenever I run it from Powershell ISE it exports csv to my local folder, but for stakeholders I should arrange user interface with button click to download the csv report.

####################################

# Export Yammer group members: https://support.microsoft.com/en-us/office/export-yammer-group-members-to-a-csv-file-201a78fd-67b8-42c3-9247-79e79f92b535
# Before running ensure the proxy is not in the way, either by updating the code, or by deactivating GRAS

# update value with Yammer Community ID
$GroupId=1234567 #my group_id
$Token = "12345678-987asdf786adsf34xxxxx" #my token
$Headers = @{ "Authorization" = "Bearer "+ $Token }
$GroupCycle = 1
DO
{
$GetMoreGroupsUri = "https://www.yammer.com/api/v1/users/in_group/$GroupId.xml?page=$GroupCycle"
write-host ("REST API CALL : $GetMoreGroupsUri")
[xml]$Xml = ((Invoke-WebRequest -Uri $GetMoreGroupsUri -Method Get -Headers $Headers).content)
$YammerGroups += $Xml.response.users.user
$GroupCycle ++
$GroupCount += $Xml.response.users.user.count
write-host ("GROUPMEMBER COUNT : $GroupCount")
}
While ($Xml.response.users.user.count -gt 0)
$YammerGroups | Where {$_} | Export-Csv "YammerCommunity$GroupId.csv" -Delimiter ","
##############################

Can someone help to achieve this?

Thanks in advance.

Simply search for “Powershell GUI”. There are many options, however, you’re still going to have a Powershell script that has to be run to start a gui to then push a button. You could just download the file to the same location as the script and skip the gui part. Here is a link for one option:

https://adamtheautomator.com/build-powershell-gui/

Make sure that you test your script outside of PowerShell ISE before you let other people use it. The ISE console is an emulation - it’s not “real” or necessarily consistent with execution in the actual operating system. It’s fine for testing while you’re working on the script, but not trustworthy as a complete test. The PowerShell team wrote up a list of differences which will give you a better understanding of the limitations of the ISE console.

Rob makes a good point - if the only function of this script is to download the report file, you could just do that when the user executes the script and skip the button entirely. Is there more to your script?