
Roddy Gelberty
Forum Replies Created
-
Roddy Gelberty
Member10 July 2020 at 3:40 pm in reply to: Powershell: win32_computersystem class not displaying all properties.Get-WmiObject -Class Win32_ComputerSystem|Select-Object -Property *
You can run the above command for the win32_computersystem class. Other classes might require you to expose the extended properties by using the -Properties switch.
$param = @("displayname", "givenname", "sn", "manager", "mail","streetaddress", "city", "st", "postalcode","co","telephonenumber", "mobile", "ipphone", "homephone","extensionattribute2", "extensionattribute3", "extensionattribute4","company", "department", "extensionattribute1", "title", "physicaldeliveryofficename") get-aduser -filter * -properties $param | Select-Object $param
-
Thanks Varun. For SCCM users we always recommend our Free SCCM task sequence orchestrator which has 18 extension attributes that can be assigned entries that originally go into the INI file. But since you use MDT, the process from the start to finish has to be done using PowerShell, leveraging the power of ‘Windows Forms’ or ‘Windows Presentation Foundation’.
Step 1: Create a Form with all the required fields. See a very short example below.
Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() $storeInfo = New-Object system.Windows.Forms.Form $storeInfo.ClientSize = New-Object System.Drawing.Point(594,113) $storeInfo.text = "Store Information Window" $storeInfo.TopMost = $false $storeInfo.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#ffffff") $storeAddress = New-Object system.Windows.Forms.Label $storeAddress.text = "Store Address : " $storeAddress.AutoSize = $false $storeAddress.width = 91 $storeAddress.height = 6 $storeAddress.location = New-Object System.Drawing.Point(10,68) $storeAddress.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $IPAddress = New-Object system.Windows.Forms.Label $IPAddress.text = "IP Address : " $IPAddress.AutoSize = $false $IPAddress.width = 108 $IPAddress.height = 5 $IPAddress.location = New-Object System.Drawing.Point(10,20) $IPAddress.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $TextBox1 = New-Object system.Windows.Forms.TextBox $TextBox1.multiline = $false $TextBox1.width = 430 $TextBox1.height = 20 $TextBox1.location = New-Object System.Drawing.Point(145,15) $TextBox1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $TextBox2 = New-Object system.Windows.Forms.TextBox $TextBox2.multiline = $false $TextBox2.width = 430 $TextBox2.height = 20 $TextBox2.location = New-Object System.Drawing.Point(145,61) $TextBox2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $storeInfo.controls.AddRange(@($storeAddress,$IPAddress,$TextBox1,$TextBox2))
Add extra fields like text boxes and combo boxes to suite your needs. This article can guide you in the right direction.
Step 2: Read your INI files and pre-populate necessary fields.
function Get-IniContent ($filePath) { $ini = @{} switch -regex -file $FilePath { "^\[(.+)\]" # Section { $section = $matches[1] $ini[$section] = @{} $CommentCount = 0 } "^(;.*)$" # Comment { $value = $matches[1] $CommentCount = $CommentCount + 1 $name = "Comment" + $CommentCount $ini[$section][$name] = $value } "(.+?)\s*=(.*)" # Key { $name,$value = $matches[1..2] $ini[$section][$name] = $value } } return $ini }
The above script was taken from Microsoft dev blog.
Step 3 : Read the values from the ‘PowerShell’ Form and write it to the INI file on your SYSTEM drive.
function Out-IniFile($InputObject, $FilePath) { $outFile = New-Item -ItemType file -Path $Filepath foreach ($i in $InputObject.keys) { if (!($($InputObject[$i].GetType().Name) -eq "Hashtable")) { #No Sections Add-Content -Path $outFile -Value "$i=$($InputObject[$i])" } else { #Sections Add-Content -Path $outFile -Value "[$i]" Foreach ($j in ($InputObject[$i].keys | Sort-Object)) { if ($j -match "^Comment[\d]+") { Add-Content -Path $outFile -Value "$($InputObject[$i][$j])" } else { Add-Content -Path $outFile -Value "$j=$($InputObject[$i][$j])" } } Add-Content -Path $outFile -Value "" } } }
The above script was taken from Microsoft dev blog.
If you run the PowerShell Form during the execution of the task sequence, remember to do the following.
$TSProgressUI = new-object -comobject Microsoft.SMS.TSProgressUI $TSProgressUI.CloseProgressDialog() $TSProgressUI = $null
The above commands turn off the progress UI.
Hope this helps.
-
Thank you Bobby!
I appreciate it. I will check it out.
-
-
Varun, can you please confirm which one of the following statements are true?
- You use a standalone MDT infrastructure and not SCCM.
- You use an SCCM infrastructure.
Can you also clarify what you mean, when you say ‘save the entered data to C:‘. Do you mean the selected choice?. If yes? in what format?
Do you have to use ‘.ini’ as a the input source?-
Hi Bobby,
Yes I am using a standalone MDT infrastructure and not SCCM.
Once the user inputs the data into Wizard, if it can save the data to the ini file and have it saved it C:\Directory after applying the image, or if there is any other way to do it.
-
Roddy Gelberty
Member9 July 2020 at 2:12 pm in reply to: Restart the Network without restarting the computer.Start your command prompt as ‘Administrator’. Execute the below commands in that order.
ipconfig /release
ipconfig /flushdns
ipconfig /renew
netsh int ip reset and do not restart.
netsh winsock reset.
The above commands will affect all your network interfaces.
-
Roddy Gelberty
Member6 July 2020 at 2:30 pm in reply to: Uninstall Microsoft whiteboard modern app (appx).Thanks for your question Jessica. Its a coincidence that I’ve been working on an offline install which has ‘Uninstall’ steps for Microsoft Whiteboard. The below two lines work most of the times. 🙂
Get-AppxPackage -Name "Microsoft.WhiteBoard" -AllUsers|Remove-AppxPackage -AllUsers
Get-AppxProvisionedPackage -Online| Where-Object {$_.DisplayName -match "Microsoft.WhiteBoard"} | Select-Object -Property PackageName | Remove-AppxProvisionedPackage -Online
-
That is brilliant. Using MDT to gather/run scripts to calculate this value increases the time to execute an SCCM task sequence. This will shorten the duration of my SCCM TS.
-
Roddy Gelberty
Member2 July 2020 at 8:37 pm in reply to: Windows File Recovery | Not compatible with Windows 10The requirements is Windows 10 19041.0 or higher. Please check if your computer has received and installed “Feature update to Windows 10 version 2004”.
-
Roddy Gelberty
Member1 July 2020 at 11:09 am in reply to: Adding device to Active Directory group in a SCCM Task Sequence (WinPE).Hey Nicolina, Below is a link to one of our blogs. The executable requires ADSI and .Net setup in your WinPE image (if used within WinPE).
https://sccmtspsi.com/add-remove-current-computer-system-to-from-an-active-directory-security-group/
If you are using osd365’s SCCM task sequence orchestrator; the software will automatically add devices based on the user’s choice before the task sequence is launched.
https://sccmtspsi.com/sccmtspsi-documentation/?section=ad-parent-ad-group-for-ad-group-list
Legacy systems use ADSI methods within VBScripts (I do not favor this). If PowerShell is enabled within WinPE you could also invoke ADSI queries using PowerShell.
Hope this helps.Documentation for SCCM task sequence deployment orchestrator
-
Roddy Gelberty
Member28 June 2020 at 8:28 pm in reply to: Intune and SCCM co-management client not getting policy from InTune.Legend. Thanks for your help. That worked.
-
Roddy Gelberty
Member28 June 2020 at 7:30 pm in reply to: Intune and SCCM co-management client not getting policy from InTune.In SCCM co-management settings (Under Administration)/Workloads slide the Compliance and/or Device Configuration sliders to either Pilot Intune or Intune.
-
Roddy Gelberty
Member28 June 2020 at 2:10 pm in reply to: Could not resolve source for the installation package (0x80070002)Thanks @topaz-george . Redistributing the Package to the distribution points worked like a charm. Luna, I’ll setup SCCMTSPSI task sequence deployment orchestrator in my organisation. We’ve got multiple teams using SCCM; so the orchestrator might be of help within our organisation to isolate task sequence objects from other objects in SCCM.
-
This reply was modified 4 years, 10 months ago by
Roddy Gelberty.
-
This reply was modified 4 years, 10 months ago by
-
Roddy Gelberty
Member27 June 2020 at 8:58 pm in reply to: Could not resolve source for the installation package (0x80070002)True. I’d definitely look at SCCM application revisions and version mismatches in the distribution point. Also, please check out our SCCM task sequence orchestrator which will check version mismatches before the SCCM task sequence deployment begins.
https://sccmtspsi.com/sccmtspsi/ -
Sure Paul,
Please find the fields example from one of the INI file, the information which goes in
to these ini files like Store Address, IP address these information is
only available to enter by field technician at the time of Deployment.
[General]store_number =00000address =city =Some CityCountry =USProvince =N/Acontact =Store Managertype =Cpetrol =0timezone =GMTdaylight =1remarks =cc_connect_type =4credit =1market =0000Three .ini files have fields like above, the information which goes in to these ini files like Store Address, IP address these information is only available to enter by field technician at the time of Deployment, once these .ini files are saved with updated information to C:\Store directory on 2016 hyper-v server, we have power shell scripts in place which will inject these .ini files to VM.