Link to home
Start Free TrialLog in
Avatar of bbimis
bbimis

asked on

is there a way to make a gui with powershell so i can enter data to modify paths, etc.

i would like to have a gui so the user can select the type of computer they want to check/install programs on.
I currently have a working script to install adobe flash silently against a list of computers
but lets say i want to check for teamviewer, firefox, etc
i want the user to be able to simply enter the correct path to check for and then also the path to the install program.
i can do it manually by modifying the code each time but it would be easier with a gui.  Can someone help me.
below is workable code using the command line.

<# 
 . Program name: flashinstaller.ps1
 . Author: 
 . Date: 11/4/2015
 .
 . Purpose: See if adobe shockwave/flash is installed. if not then install it silently
 . 
 .Version 1
 .
 . Change Log:
 .   Version 1
 #>


 # need to connect to each computer in list and need to login as administrator then adminpassword to each pc
 "Flash installer by MIS"
 "Computer to upgrade?"
 "1) Manager" 
 "2) Training"

 $menuselect = read-host "Make a selection 1 or 2"
 switch ($menuselect) {
  1 {
       $arrComputers = Get-Content -Path "C:\pc.txt"  
    }
  
  2 {
        $arrComputers = Get-Content -Path "C:\train.txt"
    }   
 }

 $creds = Get-Credential
 $ErrorLog = "c:\scripterrors.txt"
 foreach ($strComputer in $arrComputers) {
    # check and see if the flash is installed
    # map the network drive

    Try
    {
    New-PSDrive -name K -PSProvider FileSystem -Root \\$strComputer\c -Persist -Credential $creds
    
    
       if (Test-Path 'k:\Windows\System32\Macromed\Flash')
            {
            write-host $strComputer " has Flash PLUGIN "
            }
        
        else {
            write-host $strComputer "does not have FLASH copying files now"
            
            if ((Test-Path k:\temp) -eq 0) # if the path doesn't exist make it
                    {
                      write-host "temp folder doesn't exist"
                      mkdir z:\temp
                      
                    }
                      #send files
                      Copy-Item f:\common\share\flash\adobeflash.msi -Destination k:\temp
                     
          
            if ((test-path k:\temp) -eq 0) # see if the path was made
                {
                    write-host "didn't make the temp dir what happen?"
                }

                    
        
            #INSTALL THE PROGRAM SILENTLY
                      
            
            &psexec \\$strComputer -u administrator -p secret -s msiexec.exe /i "c:\temp\adobeflash.msi" /q 
			if (Test-Path 'k:\Windows\System32\Macromed\Flash')
            {
            write-host $strComputer " PLUGIN INSTALLED SUCCESSFULLY "
            }
}
			
			#>
            
        
        
      Remove-PSDrive  K
      }
      Catch
        {
       "ERROR with location:  $strComputer" | Add-Content $ErrorLog
        }
     }
     

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Steve
Steve
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial