Jump to content
DeployCentral

Recommended Posts

Hi, I am new to Smart Deploy and have been searching the forum but havent found what i am looking for and hoping someone can assist.

I want to know if you can deploy powershell scripts to client computer from the smartdeploy console.  I want to deploy simple copy or config scripts to client computers that have the smart deploy client/agent installed.

If so what is the process to configure this?  

Thanks,

CJ

Link to post
Share on other sites

You can create Application Packs for running PowerShell scripts, and push those to your SmartDeploy clients. Here's our KB article for creating custom Application Packs; 
https://support.smartdeploy.com/support/solutions/articles/48000960633-create-your-own-custom-application-pack

You'll need to add PowerShell.exe -NoProfile -NonInteractive -ExecutionPolicy bypass -File to the start of the executable path after selecting your script,, per the documentaiton. 

Link to post
Share on other sites

Thanks for the reply Jeff but unfortunately the powershell script is not deploying through Smart Deploy.  The script executes on the computer locally, so I know it works.

Is there a log file I can view to help troubleshoot the issue? 

 

thanks,

CJ

Link to post
Share on other sites
  • 5 months later...
On 1/10/2020 at 8:19 AM, Jeff Harris said:

You can create Application Packs for running PowerShell scripts, and push those to your SmartDeploy clients. Here's our KB article for creating custom Application Packs; 
https://support.smartdeploy.com/support/solutions/articles/48000960633-create-your-own-custom-application-pack

You'll need to add PowerShell.exe -NoProfile -NonInteractive -ExecutionPolicy bypass -File to the start of the executable path after selecting your script,, per the documentaiton. 

Hi Jeff! 

I tried to follow the instruction doing the following:

[ApplicationsFolder]\Teams Registry Key\Files\powershell.exe -NoProfile -NonInteractive -ExecutionPolicy bypass -file RegistryChange.ps1

powershell.exe -NoProfile -NonInteractive -ExecutionPolicy bypass -file [ApplicationsFolder]\Teams Registry Key\Files\RegistryChange.ps1

powershell.exe -NoProfile -NonInteractive -ExecutionPolicy bypass -file "[ApplicationsFolder]\Teams Registry Key\Files\RegistryChange.ps1"

[ApplicationsFolder]powershell.exe -NoProfile -NonInteractive -ExecutionPolicy bypass -file "\Teams Registry Key\Files\RegistryChange.ps1"

 

Still not luck. Hope we could get some help with this.

 

Thanks!

Link to post
Share on other sites
  • 2 months later...

Hello Guys!

 

I haven't seen any real help about this. Since last time I posted I found the Solution to correctly run the Script as Admin. In my example I'm trying to create a URL Shortcut in the Public Desktop

  • Create and Application Pack that will contain 3 tasks (1. Copy File/Folder, 2. Copy File/Folder and 3. Run Command)
  • The First Task will copy my custom icon to the WINDOWS Folder
  • The Second Task will copy the PS1 file to the Public Pictures Folder.  I'm using the Public Pictures Folder because there's no restriction to copy files there. No worries because we will delete the file later. 
  • The Third Task will Run the CMD File to RUN the PS1 file.
  • Create your CMD file that will have the code to Run the PS1 file with the following: Powershell.exe -executionpolicy bypass start-process "PowerShell.exe C:\Users\Public\Pictures\filename.ps1" -verb runas (-executionpolicy bypass allows to run the ps1 file without errors and start-process "PowerShell.exe filelocation" -verb runas allows you to run PowerShell as Admin).
  • Create the PS1 Scrip to create the Shortcut
  1. $shortcut_name = "Shortcut" (Shortcut Name)
  2. $shortcut_target = "http://webaddress" (URL of the page for your shortcut)
  3. $sh = new-object -com "WScript.Shell" (Creates the process)
  4. $p = $sh.SpecialFolders.item("AllUsersDesktop") (Location for your Shortcut. In this case trying to create it in the Public Desktop Folder running PowerShell without Admin privileges is not possible).
  5. $lnk = $sh.CreateShortcut( (join-path $p $shortcut_name) + ".lnk" )
  6. $lnk.TargetPath = $shortcut_target
  7. $lnk.IconLocation = "C:\Windows\SharePoint.ico" (Icon path was set in the FIRST TASK)
  8. $lnk.Save() (Creates the Shortcut)
  9. del C:\Users\Public\Pictures\filename.ps1 (Deletes the PS1 file from the PUBLIC PICTURES FOLDER)

This was the only way I could figure it out to Run PowerShell in Admin Mode and being able to create or copy stuff in folders that otherwise can be copied without Admin Permission.

Hope It will be helpful.

Cheers!! 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...