17 January 2016

Windows XP to Windows 7 GUI PowerShell transfer script



  It was big project for refresh/upgrade a lot off computers from Windows XP to Windows 7. For this action I did some GUI script.
First action - Script remotely asked computer name or IP after show you profiles that work on this machine and when you chose profile start coping to network folder (right now this is 127.0.0.1 J) Need some upgrade this script for make copy by robocopy or standard cmd operators (PS issue 248 length symbols) and work fastly. Same as check size of profile – don’t know how many percent done in process of copy.
Second action – When new computer online !and! user first time made logon start script again and after remotely request old computer name, new computer name transfer will be complete on new user profile.
More easier before logon but make profile without user can only Easy Transfer Microsoft program. It can make user registry hive for correctly logon.
Add-Type -assembly System.Windows.Forms
$time = Get-Date

function Check_Service_Status
{
param ($comp, $compservice)
Return $true
$stat = Get-Service $compservice -ComputerName $comp | select status

    Switch ($stat.status)
    {
        # Service Stopped'
        'Stopped'
        {
            Get-Service $compservice -ComputerName $comp  | Start-service
            Return $true}

        # Service Running'
        'Running'
        {Return $true}

        # Service Pending'
        'Pending'
        {
            $time = $time + 1
            Write-Host "Status Service waiting $time'0 second"
            If ($time -eq 10) {
            return $false }
            Start-Sleep -s 10
            check_service_status $comp $compservice}

        # Status Service not found
        Default
        {
            Write-Host "Status Service not found" -ForegroundColor Red -BackgroundColor DarkRed
            Return $false}

    }
}

Function Confirm {
        $service = "RemoteRegistry"
        Check_Service_Status ($PC, $service)
        $ConfirmWin = New-Object System.Windows.Forms.Form
        $ConfirmWin.StartPosition  = "CenterScreen"
        $ConfirmWin.Text = "Backup confirm"
        $ConfirmWin.Width = 300 #200
        $ConfirmWin.Height = 150 #120
        $ConfirmWin.FormBorderStyle      = [System.Windows.Forms.FormBorderStyle]::Fixed3D
        $RadioButton1 = New-Object System.Windows.Forms.RadioButton
        $RadioButton2 = New-Object System.Windows.Forms.RadioButton
        $RadioButton3 = New-Object System.Windows.Forms.RadioButton

$TargetDir = "c:\127.0.0.1\backup\$PC\"
$TargetDir_folder = Get-ChildItem "$TargetDir" | ?{$_.psiscontainer}
if($TargetDir_folder.Exists -eq $true){
  $RadioButton1.Enabled = $false
  $RadioButton2.Checked = $true
}else{
  $RadioButton2.Enabled = $false
  $RadioButton1.Checked = $true
}
  # radioButton1
  $RadioButton1.Location = New-Object System.Drawing.Point(10, 40)
  $RadioButton1.size = New-Object System.Drawing.Size(80,20)
  $RadioButton1.Name = 'radioButton1'
  $RadioButton1.Text = 'Backup'

  # radioButton2
  $RadioButton2.Location = New-Object System.Drawing.Point(90, 40)
  $RadioButton2.size = New-Object System.Drawing.Size(70,20)
  $RadioButton2.Name = 'radioButton2'
  $RadioButton2.Text = 'Restore'

  # radioButton3
  $RadioButton3.Location = New-Object System.Drawing.Point(170, 40)
  $RadioButton3.size = New-Object System.Drawing.Size(120,20)
  $RadioButton3.Name = 'radioButton3'
  $RadioButton3.Enabled = $false
  $RadioButton3.Text = 'Backup-Restore'
  $RadioButton3.Checked = $false

        $ConfirmWinCancelButton = New-Object System.Windows.Forms.Button
        $ConfirmWinCancelButton.add_click({ $Main_formWindow.Close(); $ConfirmWin.Close() })
        $ConfirmWinCancelButton.Text = "Cancel"
        $ConfirmWinCancelButton.AutoSize = 1
        $ConfirmWinCancelButton.Location        = New-Object System.Drawing.Point(200,80)
        $ConfirmLabel = New-Object System.Windows.Forms.Label
        If ($PC -eq ""){
            $ConfirmWinOKButton=""
            $ConfirmLabel.Text = "Try enter HOSTNAME correct"
         }else{
           $ConfirmLabel.Text = "Is it correct: $PC ?"
        $ConfirmWinOKButton = New-Object System.Windows.Forms.Button
        $ConfirmWinOKButton.add_click({ $Main_formWindow.Close(); $ConfirmWin.Close(); Choose_user_form; }) #Check
        $ConfirmWinOKButton.Text = "Yes"
        $ConfirmWinOKButton.AutoSize = 1
        $ConfirmWinOKButton.Location        = New-Object System.Drawing.Point(10,80)
       }
        $ConfirmLabel.AutoSize = 1
        $ConfirmLabel.Location  = New-Object System.Drawing.Point(10,10)
        $ConfirmWin.Controls.Add($ConfirmLabel)
        $ConfirmWin.Controls.Add($ConfirmWinOKButton)
        $ConfirmWin.Controls.Add($ConfirmWinCancelButton)
        $ConfirmWin.Controls.Add($radioButton1)
        $ConfirmWin.Controls.Add($radioButton2)
        $ConfirmWin.Controls.Add($radioButton3)
        $ConfirmWin.ShowDialog() | Out-Null
       
    }

###############################################################################
# Function:         Is-MachineAlive($strComp)
# Author:           Anthony Rufrano
# Description:      Pings a workstations to make sure it is live
###############################################################################
function Is-MachineAlive($strComp) {
    trap [System.Management.Automation.MethodInvocationException] {return $false}
    $ip = ""
    $ip = [System.Net.Dns]::GetHostByName($strComp).AddressList[0].IPAddressToString
    $res = $null
    $res = $ping.Send($ip)
    if ($res -eq $null) {return $false}
    if ($res.status.ToString() -ne "Success") {return $false}  
    return $true
}

Function User_Confirm {
        $UserConfirmWin = New-Object System.Windows.Forms.Form
        $UserConfirmWin.StartPosition  = "CenterScreen"
        $UserConfirmWin.Text = "Backup confirm"
        $UserConfirmWin.Width = 200
        $UserConfirmWin.Height = 120
        $UserConfirmWin.ControlBox = 0
        $UserConfirmWin.FormBorderStyle      = [System.Windows.Forms.FormBorderStyle]::Fixed3D
        $UserConfirmCancelButton = New-Object System.Windows.Forms.Button
        $UserConfirmCancelButton.add_click({ $Main_formWindow.Close(); $UserConfirmWin.Close() })
        $UserConfirmCancelButton.Text = "Cancel"
        $UserConfirmCancelButton.AutoSize = 1
        $UserConfirmCancelButton.Location        = New-Object System.Drawing.Point(100,50)

        $UserConfirmLabel = New-Object System.Windows.Forms.Label
        If ($User -eq "All users"){
            #$MainSendWindow.Close()
            $UserConfirmLabel.Text = "Try choose USER correct"
         }else{
        $UserConfirmLabel.Text = "Is it correct: $User ?"       
        $UserConfirmWinOKButton = New-Object System.Windows.Forms.Button
        $UserConfirmWinOKButton.add_click({ $Main_formWindow.Close(); $UserConfirmWin.Close(); Check; })
        $UserConfirmWinOKButton.Text = "Yes"
        $UserConfirmWinOKButton.AutoSize = 1
        $UserConfirmWinOKButton.Location        = New-Object System.Drawing.Point(20,50)
       }
        $UserConfirmLabel.AutoSize = 1
        $UserConfirmLabel.Location  = New-Object System.Drawing.Point(10,10)
        $UserConfirmWin.Controls.Add($UserConfirmLabel)
        $UserConfirmWin.Controls.Add($UserConfirmWinOKButton)
        $UserConfirmWin.Controls.Add($UserConfirmCancelButton)
        $UserConfirmWin.ShowDialog() | Out-Null
       
    }

Function Check
{
    $shell = New-Object -ComObject Wscript.Shell
    $shell.popup("Process started",1,"Backup" , 64)
    $Choose_user_form.Close()
    $Main_formWindow.Close()
    $UserConfirmWin.Close()
    Backup_process
}

Function Backup_process
{
Write-Host $PC,$User
$UserDir = "\\$PC\d$\Documents and Settings\$User"

$MyDocuments = "$UserDir\My Documents"
$Desktop = "$UserDir\Desktop"
$Favorites = "$UserDir\Favorites"
$Outlook = "$UserDir\Local Settings\Application Data\Microsoft\Outlook"
$Signatures = "$UserDir\Application Data\Microsoft\Signatures"
$Outlook = "$UserDir\Application Data\Microsoft\Outlook"
$Chrome = "$UserDir\Local Settings\Application Data\Google\Chrome\User Data\Default"
$Firefox = "$UserDir\Application Data\Mozilla\Firefox\Profiles"

$TargetDir = "c:\127.0.0.1\backup\$PC\$User"
if(!(Test-Path -Path $TargetDir )){New-Item -ItemType directory -Path $TargetDir}

$Backup_MyDocuments = "$TargetDir\My Documents"
$Backup_Desktop = "$TargetDir\Desktop"
$Backup_Favorites = "$TargetDir\Favorites"
$Backup_Signatures = "$TargetDir\Signatures"
$Backup_Chrome = "$TargetDir\Chrome\Default"
$Backup_Firefox = "$TargetDir\Firefox"
$Backup_Outlook = "$TargetDir\Outlook"


Copy-Item $MyDocuments -Destination $Backup_MyDocuments -Recurse
Write-Host("MyDocuments Transfered")
Copy-Item $Desktop -Destination $Backup_Desktop -Recurse
Write-Host("Desktop Transfered")
Copy-Item $Favorites -Destination $Backup_Favorites -Recurse
Write-Host("Favorites Transfered")

if(Test-Path -Path $Firefox){
    $files = Get-ChildItem -Path $Firefox -Recurse
    $filecount = $files.count
    Copy-Item $Firefox -Destination $Backup_Firefox -Recurse
    Write-Host("Firefox Transfered")
}
else {Write-Host("Firefox didn't Transfered") -ForegroundColor Red}

if(Test-Path -Path $Signatures){
    Copy-Item $Signatures -Destination $Backup_Signatures -Recurse
    Write-Host("Signatures Transfered")
}
else {Write-Host("Signatures didn't Transfered") -ForegroundColor Red}

if(Test-Path -Path $Chrome){
    $Chrome_files = Get-ChildItem "$Chrome" | ?{!$_.psiscontainer}
    New-Item -ItemType directory -Path $Backup_Chrome
    foreach ($Chrome_files_result in $Chrome_files) {
    Copy-Item $Chrome_files_result.FullName -Destination "$Backup_Chrome\$Chrome_files_result"
    }
    Write-Host("Chrome Transfered")}
else { Write-Host("Chrome didn't Transfered") -ForegroundColor Red}
}

Function Main_form {
     $Main_formWindow = New-Object System.Windows.Forms.Form
     $ToolTip0 = New-Object System.Windows.Forms.ToolTip
     $ToolTip0.BackColor = [System.Drawing.Color]::LightGoldenrodYellow
     $ToolTip0.IsBalloon = $true
     $Main_formWindow.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::Fixed3D
     $Main_formWindow.Font = New-Object System.Drawing.Font("Comic Sans MS",10)
     $SendButton = New-Object System.Windows.Forms.Button
     $CloseButton = New-Object System.Windows.Forms.Button
     $HostnameTextBox = New-Object System.Windows.Forms.TextBox    
     $HostnameTextBoxLabel = New-Object System.Windows.Forms.Label

# Главная форма
$Main_formWindow.StartPosition  = "CenterScreen"
$Main_formWindow.Text           = "XP user backup $time"
$Main_formWindow.Width          = 300
$Main_formWindow.Height         = 180

# Подписи к текстовым полям
$HostnameTextBoxLabel.Location   = New-Object System.Drawing.Point(10,42)
$HostnameTextBoxLabel.Text       = "Hostname"
$HostnameTextBoxLabel.Autosize     = 1

$HostnameTextBox.Location          = New-Object System.Drawing.Point(100,40)
$HostnameTextBox.Text              = ""
$HostnameTextBox.add_TextChanged({ $UserX = $UserTextBox.Text })
$HostnameTextBox.Width             = 150
$ToolTip0.SetToolTip($HostnameTextBox, "Enter HOSTNAME")

# Кнопка отправки.
$SendButton.Location           = New-Object System.Drawing.Point(10,100)
$SendButton.Text               = "Choose Hostname"
$SendButton.add_click({ $PC = $HostnameTextBox.Text; $Main_formWindow.Close(); Confirm; } )
$SendButton.Autosize           = 1
$SendButton.TabIndex           = 5
$ToolTip0.SetToolTip($SendButton, "Click")

# Кнопочка выхода, по событию вызывает метод закрытия
$CloseButton.Location          = New-Object System.Drawing.Point(200,100)
$CloseButton.Text              = "Exit"
$CloseButton.add_click({ $Main_formWindow.Close(); })
$CloseButton.Autosize          = 1
$CloseButton.TabIndex          = 7
$ToolTip0.SetToolTip($CloseButton, "Out")

$Main_formWindow.Controls.Add($HostnameTextBoxLabel)
$Main_formWindow.Controls.Add($HostnameTextBox)
$Main_formWindow.Controls.Add($SendButton)
$Main_formWindow.Controls.Add($CloseButton)

$Main_formWindow.ShowDialog() | Out-Null
}

Function Choose_user_form {
if ($RadioButton2.Checked -eq $true) {
RestoreData
}else{

# Choose_user_form
    $res = $true #Is-MachineAlive($PC)
    if ($res -eq $false) {
        Write-Host("$comp not pingable")
        $PC = ""
        Confirm
   }else{
     $Choose_user_form = New-Object System.Windows.Forms.Form
     $ToolTip = New-Object System.Windows.Forms.ToolTip

     $ToolTip.BackColor = [System.Drawing.Color]::LightGoldenrodYellow
     $ToolTip.IsBalloon = $true
     $Choose_user_form.ControlBox           = 0
     $Choose_user_form.FormBorderStyle      = [System.Windows.Forms.FormBorderStyle]::Fixed3D
     $Choose_user_form.Font                 = New-Object System.Drawing.Font("Comic Sans MS",10)
     $SendButton                   = New-Object System.Windows.Forms.Button
     $CloseButton                   = New-Object System.Windows.Forms.Button
     $UserTextBox                   = New-Object System.Windows.Forms.ComboBox
     $UserTextBoxLabel           = New-Object System.Windows.Forms.Label

# Backup user form
$Choose_user_form.StartPosition  = "CenterScreen"
$Choose_user_form.Text           = "Backup for $PC. Choose user."
$Choose_user_form.Width          = 300
$Choose_user_form.Height         = 180

# Description text field
$UserTextBoxLabel.Location   = New-Object System.Drawing.Point(10,42)
$UserTextBoxLabel.Text       = "User"
$UserTextBoxLabel.Autosize     = 1

# Choosing folders from remote machine
$User = Get-ChildItem "\\$PC\d$\Documents and Settings" | ?{$_.psiscontainer}

$UserTextBox.Location          = New-Object System.Drawing.Point(100,40)
$UserTextBox.DataSource        = $User
$UserTextBox.Text              = $User[1]
$UserTextBox.add_TextChanged({ $UserX = $UserTextBox.Text })
$UserTextBox.Width             = 150
$UserTextBox.TabIndex          = 4
$ToolTip.SetToolTip($UserTextBox, "Choose user for backup")

$SendButton.Location           = New-Object System.Drawing.Point(10,100)
$SendButton.Text               = "Start backup"
$SendButton.add_click({ $User = $UserTextBox.Text; User_Confirm} )
$SendButton.Autosize           = 1
$SendButton.TabIndex           = 5
$ToolTip.SetToolTip($SendButton, "Click")

$CloseButton.Location          = New-Object System.Drawing.Point(200,100)
$CloseButton.Text              = "Exit"
$CloseButton.add_click({ $Choose_user_form.Close() })
$CloseButton.Autosize          = 1
$CloseButton.TabIndex          = 7
$ToolTip.SetToolTip($CloseButton, "Out")

$Choose_user_form.Controls.Add($UserTextBoxLabel)
$Choose_user_form.Controls.Add($UserTextBox)
$Choose_user_form.Controls.Add($SendButton)
$Choose_user_form.Controls.Add($CloseButton)

$Choose_user_form.ShowDialog() | Out-Null
}
}
}

Function Restore_user_data{
If ($newPC -eq ""){
}else{
        $service = "RemoteRegistry"
        Check_Service_Status ($newPC, $service)
        Get-Service $service -ComputerName $newPC  | Start-service
        $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine", $newPC)
        $regKey= $reg.OpenSubKey("SOFTWARE\\Policies\\Google\\Update",$true)
        $regKey.SetValue("AutoUpdateCheckPeriodMinutes",0x99999999,[Microsoft.Win32.RegistryValueKind]::DWORD)
        $regKey.SetValue("DisableAutoUpdateChecksCheckboxValue",0,[Microsoft.Win32.RegistryValueKind]::DWORD)
        $regKey.SetValue("UpdateDefault",1,[Microsoft.Win32.RegistryValueKind]::DWORD)

$UserDir = "\\$newPC\c$\Users\$User"
$RestoredOutlook = "$UserDir\Local Settings\Application Data\Microsoft\Outlook"
$RestoredSignatures = "$UserDir\AppData\Roaming\Microsoft\Signatures"
$RestoredOutlook = "$UserDir\AppData\Roaming\Microsoft\Outlook"
$RestoredChrome = "$UserDir\AppData\Local\Google\Chrome\User Data"
$RestoredFirefox = "$UserDir\Application Data\Mozilla\Firefox\Profiles"

$TargetDir = "c:\127.0.0.1\backup\$PC\$User"
if(Test-Path -Path "$TargetDir\My Documents"){
    Copy-Item "$TargetDir\My Documents" -Destination $UserDir -Recurse -Force
    Write-Host("My Documents Restored")}
else {Write-Host("My Documents didn't Restored") -ForegroundColor Red}

if(Test-Path -Path "$TargetDir\Desktop"){
    Copy-Item "$TargetDir\Desktop" -Destination $UserDir -Recurse -Force
    Write-Host("Desktop Restored")}
else {Write-Host("Desktop didn't Restored") -ForegroundColor Red}

if(Test-Path -Path "$TargetDir\Favorites"){
    Copy-Item "$TargetDir\Favorites" -Destination $UserDir -Recurse -Force
    Write-Host("Favorites Restored")
}
else {Write-Host("Favorites didn't Restored") -ForegroundColor Red}

if(Test-Path -Path "$TargetDir\Chrome\Default"){
    Copy-Item "$TargetDir\Chrome\Default" -Destination $RestoredChrome -Recurse -Force
    Write-Host("Chrome Restored")}
else {Write-Host("Favorites didn't Restored") -ForegroundColor Red}

if(Test-Path -Path "$TargetDir\Signatures"){
    Copy-Item "$TargetDir\Signatures" -Destination $RestoredSignatures -Recurse -Force
    Write-Host("Signatures Restored")
}
else {Write-Host("Signatures didn't Restored") -ForegroundColor Red}
    Copy-Item "$TargetDir\Outlook" -Destination $Restored0utlook -Recurse -Force
    Write-Host("Outlook Restored")
}
}

Function RestoreData {
     $RestoreDataFormWindow                = New-Object System.Windows.Forms.Form
     $ToolTip1 = New-Object System.Windows.Forms.ToolTip
     $ToolTip1.BackColor = [System.Drawing.Color]::LightGoldenrodYellow
     $ToolTip1.IsBalloon = $true
     $RestoreDataFormWindow.FormBorderStyle      = [System.Windows.Forms.FormBorderStyle]::Fixed3D
     $RestoreDataFormWindow.Font                 = New-Object System.Drawing.Font("Comic Sans MS",10)
     $RestoreDataSendButton                    = New-Object System.Windows.Forms.Button
     $RestoreDataCloseButton                   = New-Object System.Windows.Forms.Button
     $RestoreDataHostnameTextBox                   = New-Object System.Windows.Forms.TextBox
     $RestoreDataHostnameTextBoxLabel           = New-Object System.Windows.Forms.Label

$RestoreDataFormWindow.StartPosition  = "CenterScreen"
$RestoreDataFormWindow.Text           = "Backup for $PC"
$RestoreDataFormWindow.Width          = 400
$RestoreDataFormWindow.Height         = 180

$RestoreDataHostnameTextBoxLabel.Location   = New-Object System.Drawing.Point(10,42)
$RestoreDataHostnameTextBoxLabel.Text       = "NEW computer Hostname "
$RestoreDataHostnameTextBoxLabel.Autosize     = 1

$RestoreDataHostnameTextBox.Location          = New-Object System.Drawing.Point(200,40)
$RestoreDataHostnameTextBox.Text              = ""
$RestoreDataHostnameTextBox.add_TextChanged({ $newPC = $RestoreDataHostnameTextBox.Text })
$RestoreDataHostnameTextBox.Width             = 150
$ToolTip1.SetToolTip($RestoreDataHostnameTextBox, "Enter NEW HOSTNAME")

$RestoreDataSendButton.Location           = New-Object System.Drawing.Point(10,100)
$RestoreDataSendButton.Text               = "Choose new Hostname"
$RestoreDataSendButton.add_click({ $newPC = $RestoreDataHostnameTextBox.Text; $RestoreDataFormWindow.Close(); NewPC_Confirm; } )
$RestoreDataSendButton.Autosize           = 1
$RestoreDataSendButton.TabIndex           = 5
$ToolTip1.SetToolTip($RestoreDataSendButton, "Click")

$RestoreDataCloseButton.Location          = New-Object System.Drawing.Point(300,100)
$RestoreDataCloseButton.Text              = "Exit"
$RestoreDataCloseButton.add_click({ $RestoreDataFormWindow.Close(); })
$RestoreDataCloseButton.Autosize          = 1
$RestoreDataCloseButton.TabIndex          = 7
$ToolTip1.SetToolTip($RestoreDataCloseButton, "Out")

$RestoreDataFormWindow.Controls.Add($RestoreDataHostnameTextBoxLabel)
$RestoreDataFormWindow.Controls.Add($RestoreDataHostnameTextBox)
$RestoreDataFormWindow.Controls.Add($RestoreDataSendButton)
$RestoreDataFormWindow.Controls.Add($RestoreDataCloseButton)
$RestoreDataFormWindow.ShowDialog() | Out-Null
}

Function NewPC_Confirm {
       $NewPCConfirmWin = New-Object System.Windows.Forms.Form
        $NewPCConfirmWin.StartPosition  = "CenterScreen"
        $NewPCConfirmWin.Text = "Restore confirm"
        $NewPCConfirmWin.Width = 270
        $NewPCConfirmWin.Height = 180
        $NewPCConfirmWin.ControlBox = 0
        $NewPCConfirmWin.Font                 = New-Object System.Drawing.Font("Comic Sans MS",10)
        $NewPCConfirmWin.FormBorderStyle      = [System.Windows.Forms.FormBorderStyle]::Fixed3D

        $NewPCConfirmCancelButton = New-Object System.Windows.Forms.Button
        $NewPCConfirmCancelButton.add_click({ $Main_formWindow.Close(); $NewPCConfirmWin.Close() })
        $NewPCConfirmCancelButton.Text = "Cancel"
        $NewPCConfirmCancelButton.AutoSize = 1
        $NewPCConfirmCancelButton.Location        = New-Object System.Drawing.Point(160,100)

        $TargetDirBackup = "c:\127.0.0.1\backup\$PC"
        $PCbackup_here = Test-Path -Path $TargetDirBackup
        if ($PCbackup_here -eq $true){$User = Get-ChildItem $TargetDirBackup | ?{$_.psiscontainer}}
       
        $TargetDirNewPC = "\\NewPC\c$\Users\$User"
        $User_here = Test-Path -Path $TargetDirNewPC
        if ($User_here -eq $false){
            #$PCbackup_here = $false
            #$User = Get-ChildItem $TargetDirBackup | ?{$_.psiscontainer}
        }

        $NewPCConfirmLabel = New-Object System.Windows.Forms.Label
        If ($NewPC -eq "" -xor $PCbackup_here -eq $false){
            $NewPCConfirmLabel.Text = "Try choose NewPC or user correct"
         }else{
           $NewPCConfirmLabel.Text = "Is it correct?`r`n`r`nNEW Hostname: $NewPC`r`nUser: $User"
       
        $NewPCConfirmWinOKButton = New-Object System.Windows.Forms.Button
        $NewPCConfirmWinOKButton.add_click({ $Main_formWindow.Close(); $NewPCConfirmWin.Close(); CheckPC; })
        $NewPCConfirmWinOKButton.Text = "Yes"
        $NewPCConfirmWinOKButton.AutoSize = 1
        $NewPCConfirmWinOKButton.Location        = New-Object System.Drawing.Point(20,100)
       }
        $NewPCConfirmLabel.AutoSize = 1
        $NewPCConfirmLabel.Location  = New-Object System.Drawing.Point(10,10)
        $NewPCConfirmWin.Controls.Add($NewPCConfirmLabel)
        $NewPCConfirmWin.Controls.Add($NewPCConfirmWinOKButton)
        $NewPCConfirmWin.Controls.Add($NewPCConfirmCancelButton)
        $NewPCConfirmWin.ShowDialog() | Out-Null
    }

Function CheckPC
{
    $shell = New-Object -ComObject Wscript.Shell
    $shell.popup("Restore started",1,"Restore" , 64)
    $Main_formWindow.Close()
    Restore_user_data
}
Main_form

No comments:

Post a Comment