Computer branding with PDQ

Hey
What do you say we give it a shot and try to do computer branding with PDQ?

Here you have a code you can try to experiment with.

More information about $location check out this post, there you can read how to fetch the information and import it into PDQ Inventory database.

$location = "where you want to store CSV file that PDQ will fetch from"
$localLocation "where you want to store local txt file"

#Featch Values
function MenuGui()
{
#To use the .NET functionality to create forms, we use the class System.Windows.Forms. To load this class into a PowerShell session, you can use the following code:
Add-Type -assembly System.Windows.Forms

#Now create the screen form (window)
$main_form = New-Object System.Windows.Forms.Form

#Set the title and size of the window:
$main_form.Text ='Helpdesk'
$main_form.Width = 400
$main_form.Height = 50

#To make the form automatically stretch, if the elements on the form are out of bounds, we use the AutoSize property.
$main_form.AutoSize = $true

#Create a label element on the form about user name
$Label = New-Object System.Windows.Forms.Label
$Label.Text = "User: " + $WhoAmI
$Label.Location  = New-Object System.Drawing.Point(150,10)
$Label.AutoSize = $true
$main_form.Controls.Add($Label)

#Create a secound label element on the form about computer name
$Label2 = New-Object System.Windows.Forms.Label
$Label2.Text = "Computer name: " + $Hostname  
$Label2.Location  = New-Object System.Drawing.Point(150,25)
$Label2.AutoSize = $true
$main_form.Controls.Add($Label2)

  # Add Button 1
    $Button = New-Object System.Windows.Forms.Button
    $Button.Location = New-Object System.Drawing.Size(150,45)
    $Button.Size = New-Object System.Drawing.Size(145,23)
    $Button.Text = "Change Owner"
    $main_form.Controls.Add($Button)
  
  #Add close form function to the button, when you click
        $Button.add_click({
        $employees = @($Hostname+","+$WhoAmI)
        $employees | foreach { Add-Content -Path $locationv -Value $_ }
        New-Item -Path $localLocation\ -Name "Owner.txt" -ItemType "file" -Value $env:UserName -Force
        $main_form.Close()})

    
#Create a label element on the form about user name
$Label3 = New-Object System.Windows.Forms.Label
$Label3.Text = "You get this message for our systems says someone else is the owner of this computer`n then the user who is logged in. Please press Change Owner if its incorrect`n`nIf any question contact us on Phone: XXX, Email: xxx@xxx.com "
$Label3.Location  = New-Object System.Drawing.Point(1,80)
$Label3.AutoSize = $true
$main_form.Controls.Add($Label3)
  

#Now you can display the form on the screen.
$main_form.ShowDialog()
}

#Variable
$Hostname = $env:COMPUTERNAME
$WhoAmI = $env:UserName


$WantFile = "$localLocation\Owner.txt"
$FileExists = Test-Path $WantFile
If ($FileExists -eq $True) 
{
    Write-Host "Yippee file exist"
}

Else 
{
    New-Item -Path $localLocation\ -Name "Owner.txt" -ItemType "file" -Value $env:UserName -Force
    $employees = @($Hostname+","+$WhoAmI)
    $employees | foreach { Add-Content -Path $location -Value $_ }
    Write-Host "NO! File do not exist"
}


$textfile = Get-Content -Path $localLocation\Owner.txt

if($textfile -eq $env:UserName)
{
  echo "True value, do not run the script";
}
else
{
    echo "wrong value, please run the script";
    MenuGui
}

Enjoy!


Import data to PDQ Inventory

Do you have external data you want to import to PDQ Inventory?

With the help of this PHP code, you can do this.


$TempFile = "specify where the file is located"
$Computer = "Name"
$CustomFieldName = "Owner"
$CustomFieldType = "String" # Valid types - Boolean, String, Integer, Date, or DateTime
PDQInventory.exe ImportCustomFields -FileName $TempFile -ComputerColumn $Computer -CustomFields "$CustomFieldName=$CustomFieldName" -AllowOverwrite

A good place to find help is PDQ Community

PDQ Deployer

How to deploy with PDQ Deployer

First, you need to remote that server that contains PDQ Deployer

Start the application

Left side you have done packages, on the right top you can see the latest deployment, the right bottom you what computer was involved in that deployment and how did it go.

How to deploy something

Pick a package you want to deploy on the left side.
Right-click on it and pick Deploy Once

Typ computer name you want to deploy in and click on Add Computer
Then after done (you can add more than one) you click on Deploy Now.

Then you are done.