SCCM by Davis |
- Rod Trent posted an update in the group System Center Configuration Manager 2012: Slow logon hotfix KB2617858 and ConfigMgr Client Health
- Rod Trent posted an update in the group System Center Operations Manager: SCOM 2007 R2 - The term 'Get-ManagementServer' is not […]
- Rod Trent posted an update in the group Microsoft Desktop Optimization Pack (MDOP): Config Pack released to monitor and remediate UE-V
- Rod Trent wrote a new post, Config Pack released to monitor and remediate UE-V
- Rod Trent posted an update in the group Windows RT: Is the Windows RT Surface a good business solution?
- Rod Trent posted an update in the group Microsoft Surface: Is the Windows RT Surface a good business solution?
- Rod Trent posted an update in the group Windows 8: Zoom, navigate and organize the Windows 8 Start screen
- Rod Trent wrote a new post, Zoom, navigate and organize the Windows 8 Start screen
- Rod Trent wrote a new post, Is the Windows RT Surface a good business solution?
- Enhansoft wrote a new post, Reminder to Request November’s Free SSRS Report
- LTI/ZTI PowerShell: Exit codes
- fabio senni replied to the forum topic SW whose installation reboots computer: can I use a TS to install it? in the group System Center Configuration Manager 2007
- fabio senni replied to the forum topic SW whose installation reboots computer: can I use a TS to install it? in the group System Center Configuration Manager 2007
- Cliff Hobbs wrote a new post, [MDT] Where can I get a list of Default Input Locale values and Language Packs for Windows?
- Rod Trent posted an update in the group Windows 8: How To Refresh Or Reset Your Windows 8 PC [Complete Guide]
- Rod Trent posted an update in the group The Word at myITforum: John 1:1-5 1 In the beginning was the Word, and the Word […]
- Kim Cross replied to the forum topic SW whose installation reboots computer: can I use a TS to install it? in the group System Center Configuration Manager 2007
- Kim Cross joined the group System Center Configuration Manager 2007
- Vicente Tejerina became a registered member
- Andrew Hurst joined the group Application Deployment
Posted: 12 Nov 2012 02:16 PM PST |
Posted: 12 Nov 2012 02:15 PM PST |
Posted: 12 Nov 2012 01:27 PM PST |
Rod Trent wrote a new post, Config Pack released to monitor and remediate UE-V Posted: 12 Nov 2012 01:26 PM PST With the recent release of User Experience Virtualization, it's a welcome sight to see a Configuration Pack released that can monitor and manage the configuration of the UE-V clients. This Config Pack monitors […] Comments: 0 |
Posted: 12 Nov 2012 11:24 AM PST |
Posted: 12 Nov 2012 11:24 AM PST |
Posted: 12 Nov 2012 11:23 AM PST |
Rod Trent wrote a new post, Zoom, navigate and organize the Windows 8 Start screen Posted: 12 Nov 2012 11:22 AM PST |
Rod Trent wrote a new post, Is the Windows RT Surface a good business solution? Posted: 12 Nov 2012 10:56 AM PST I could end this post right here, right now, with a single word. But, I won't. And, as someone who carefully considers all the nuances of a new technology, my single word statement could be taken in a number of […] Comments: 0 |
Enhansoft wrote a new post, Reminder to Request November’s Free SSRS Report Posted: 12 Nov 2012 10:44 AM PST This month's free SSRS report is Software Metering Dashboard. This report normally costs $200, but for this month only it is free! Request your free copy by sending an email to Info at Enhansoft. Software […] Comments: 0 |
LTI/ZTI PowerShell: Exit codes Posted: 27 Sep 2012 09:00 PM PDT When you run a script in your deployments, it's good practice to let MDT/SCCM know how the script has ended. This will determine how your task sequence proceeds. You do this by exiting the script with a return code. I've removed some of the enhancements to my Rename-Computer script to demonstrate Exit codes. Param ( [String]$Name = $TSEnv:OSDComputername, [String]$WorkGroupName ) Begin{ Import-Module ZTIUtility } Process{ # Rename the Computer using WMI $Result = (Get-WmiObject win32_computersystem).rename($Name) If ($Result.ReturnValue -ne 0) { Write-Error "Error renaming computer" Exit $Result.ReturnValue } # Join a Workgroup Add-Computer -WorkGroupName $WorkGroupName -WarningAction SilentlyContinue If ($? -eq $false) { Write-Error "Error Joining Workgroup" Exit 1 } } End{ Write-Host "The requested operation was successful. Changes will not be effective until the system is rebooted." Exit 0 } There are 2 commands in the script and I've handled them differently. If there are no errors then the script will reach the end of the script and exit with the desired exit code. Why exit with code 0? Well it's not my choice but if you follow the MSDN – list of system error codes then you'll see that the success exit code is 0. ERROR_SUCCESS 0 (0x0) The operation completed successfully. A reboot is 3010: ERROR_SUCCESS_REBOOT_REQUIRED 3010 (0xBC2) The requested operation is successful. Changes will not be effective until the system is rebooted. So why not use 3010 as this script will always require a reboot after a successful execution.? Well, I would but if your script exits with anything else from 0 then MDT gives you a great "Danger! Will Robinson!" at the end. The 2 commands in the script work differently so I've handled them differently. The script passes the rename computer command to a $Results variable and checks that it has returned with a 0. if not then it passes the ReturnValue to the exit code. With the join workgroup command the script checks that the last command has executed without error by testing the last completed action variable $?. If it is not true then the script exits with the return code 1. Remember you only have to use Write-Error and non 0 codes if you want fire and brimstone at the end of your deployments, in response to undesired executions. In some cases, you may wish to simply report the non 0 codes and exit with a friendly Write-Host message. Additional reading: |
Posted: 12 Nov 2012 05:34 AM PST Additional info: since the applications (all of them) are installed fine, I could just ignore this error. And, I'm going to do so, but... I'd just like to understabnd what happens! Comments: 0 |
Posted: 12 Nov 2012 05:32 AM PST Hello Kim, Comments: 0 |
Posted: 12 Nov 2012 05:17 AM PST Question: Comments: 0 |
Posted: 12 Nov 2012 04:58 AM PST |
Posted: 12 Nov 2012 04:52 AM PST John 1:1-5 1 In the beginning was the Word, and the Word was with God, and the Word was God. Comments: 0 |
Posted: 12 Nov 2012 03:31 AM PST Hi Fabio, Comments: 0 |
Kim Cross joined the group System Center Configuration Manager 2007 Posted: 12 Nov 2012 03:12 AM PST Comments: 0 |
Vicente Tejerina became a registered member Posted: 12 Nov 2012 02:07 AM PST Comments: 0 |
Andrew Hurst joined the group Application Deployment Posted: 12 Nov 2012 01:21 AM PST Comments: 0 |
You are subscribed to email updates from SCCM by Davis To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No hay comentarios:
Publicar un comentario