In addition to what Andre said below, you can do something like this to capture the exit code of the script (if it returns one).
powershell –executionpolicy bypass .\MyScript.ps1; exit $LASTEXITCODE From: [email protected] [mailto:[email protected]] On Behalf Of Andre Vrankovic Sent: Thursday, March 03, 2016 7:45 PM To: [email protected] Subject: [mssms] RE: Powershell help You could also call you script using powershell exe setting the execution policy, this is essentially how we do it in either a TS package/program method or an application deployment. Powershell –executionpolicy bypass –file fred.ps1 From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Troy Martin Sent: Friday, 4 March 2016 8:54 To: [email protected]<mailto:[email protected]> Subject: [mssms] RE: Powershell help what is the Computer Agent setting configured for? [cid:[email protected]] Troy L. Martin | Technical Architect 1E | Software Lifecycle Automation for the Digital Business US Mobile: +1 (678) 898-6147 | UK Phone : +44 208 326 9141 [email protected]<mailto:[email protected]> | www.1e.com<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.1e.com_&d=BQMFAg&c=Ln8c1CLEgbhz4W2FGOnrXYpHvIYN4k_cXHVmsANM4XI&r=zAhc69MwvUId2afOheLZsnttbIFqxDANe5KRT-ZKir4&m=uHdy6p01-w9GZjdBVTraJ5PHeWP6yKoA_xCBrm33uC4&s=lfm9K0cSqM44FHIoBa6p0wzT4MWYkn_0HYGNmWgkATs&e=> Facebook<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.facebook.com_1eglobal&d=BQMFAg&c=Ln8c1CLEgbhz4W2FGOnrXYpHvIYN4k_cXHVmsANM4XI&r=zAhc69MwvUId2afOheLZsnttbIFqxDANe5KRT-ZKir4&m=uHdy6p01-w9GZjdBVTraJ5PHeWP6yKoA_xCBrm33uC4&s=RRWJDZaMGcmivktB58TkvRLoQr1bC6jIDj-MN1oDLlE&e=> | Twitter<https://urldefense.proofpoint.com/v2/url?u=https-3A__twitter.com_1e-5Fglobal_&d=BQMFAg&c=Ln8c1CLEgbhz4W2FGOnrXYpHvIYN4k_cXHVmsANM4XI&r=zAhc69MwvUId2afOheLZsnttbIFqxDANe5KRT-ZKir4&m=uHdy6p01-w9GZjdBVTraJ5PHeWP6yKoA_xCBrm33uC4&s=6SY99zYqJ1R5pAavjFi-JmFdxUD0lt-n0XwOK-omJcI&e=> | YouTube<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.youtube.com_1enews&d=BQMFAg&c=Ln8c1CLEgbhz4W2FGOnrXYpHvIYN4k_cXHVmsANM4XI&r=zAhc69MwvUId2afOheLZsnttbIFqxDANe5KRT-ZKir4&m=uHdy6p01-w9GZjdBVTraJ5PHeWP6yKoA_xCBrm33uC4&s=XWjlpxF0vI8J3n42uqWMrEXgHphlWI2PD9XZHOHhX8U&e=> | Blogs<https://urldefense.proofpoint.com/v2/url?u=http-3A__blogs.1e.com_&d=BQMFAg&c=Ln8c1CLEgbhz4W2FGOnrXYpHvIYN4k_cXHVmsANM4XI&r=zAhc69MwvUId2afOheLZsnttbIFqxDANe5KRT-ZKir4&m=uHdy6p01-w9GZjdBVTraJ5PHeWP6yKoA_xCBrm33uC4&s=tKrxeysyE64idSmjz1G3NP2ojp9RhRdpv1OljUgTbyg&e=> | RSS<https://urldefense.proofpoint.com/v2/url?u=http-3A__blogs.1e.com_index.php_feed_&d=BQMFAg&c=Ln8c1CLEgbhz4W2FGOnrXYpHvIYN4k_cXHVmsANM4XI&r=zAhc69MwvUId2afOheLZsnttbIFqxDANe5KRT-ZKir4&m=uHdy6p01-w9GZjdBVTraJ5PHeWP6yKoA_xCBrm33uC4&s=qGt8-ZGt5rG-J3ClWoppG9TfmFKmktUZprrf0vtNjII&e=> From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Aday, Karalene B (RCIS) Sent: Thursday, March 3, 2016 4:45 PM To: [email protected]<mailto:[email protected]> Subject: [mssms] Powershell help This is our first powershell script we are deploying. We use in Task sequence but have never deployed in a package. The script works like intended but it need to run in admin mode. Can some tell me the command I use to do the following: 1. set-executionpolicy bypass 2. Start powershell in admin mode 3. Run script Thank you!!!! ________________________________ Legal Notice: This email is intended only for the person(s) to whom it is addressed. If you are not an intended recipient and have received this message in error, please notify the sender immediately by replying to this email or calling +44(0) 2083269015 (UK) or +1 866 592 4214 (USA). This email and any attachments may be privileged and/or confidential. The unauthorized use, disclosure, copying or printing of any information it contains is strictly prohibited. The opinions expressed in this email are those of the author and do not necessarily represent the views of 1E Ltd. Nothing in this email will operate to bind 1E to any order or other contract. ________________________________ This message is for the designated recipient only and may contain confidential, proprietary or otherwise private information. If you have received it in error, please notify the sender by return e-mail immediately and delete the original. Any review, re-transmission, disclosure, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited and may result in legal proceedings against you. The sender does not guarantee that this email and any attachments will be virus-free and will not affect your computer. ________________________________ Confidentiality Notice: This e-mail is intended only for the addressee named above. It contains information that is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying, or dissemination of this transmission, or taking of any action in reliance on its contents, or other use is strictly prohibited. If you have received this transmission in error, please reply to the sender listed above immediately and permanently delete this message from your inbox. Thank you for your cooperation.
