Quantcast
Channel: Windows PowerShell forum
Viewing all 21975 articles
Browse latest View live

PS Dynamic Script for Test-Connection on OU and SubOU.

$
0
0

I have a non working PowerShell script for searching an OU in an 2008 level Active directory, but it is obviously incomplete. I was able to retrieve part of the script from another forum (cant remember which one, or I would kindly give them the credit they deserve), but I was hoping to include a variable to in the "SearchBase" option below and make it dynamic, where I can change the OU to ping from a top level and have it also work under a child OU if I need to.

Outcome: Ping OU and child OU and have the option to ping either selection. Of course I would manually enter in my Search base parameters when prompted from the shell. I just want to have any easy way of ping all computers from an OU level without having to paste the lower part of the script to my PowerShell script pane and changing the OU from there. If I can get the correct parameters working, then it would be easy to load this function to my PS profile. Thank you, and help is appreciated. Hoping someone can let me know what I am missing to get this functional.

functionget-DCping


{

   

[CmdletBinding()]


   

[Alias()]


   

[OutputType([int])]


   

Param


    (

       

# Param1 help description


       

[Parameter(Mandatory=$true,


                   ValueFromPipelineByPropertyName

=$true,


                   Position

=0)]


       

[string]$Search)

  

$rtn=$null


  

Get-ADComputer-Filter*-SearchBase'OU=$Search,DC=domain,DC=domain' |


%

{$rtn=Test-Connection-CN$_.name-Count1-BufferSize16-Quiet


IF

($rtn-match'True') {write-host-ForegroundColorgreen$_.name}


ELSE

{ Write-host-ForegroundColorred$_.name }}

}



How to use Start-Job?

$
0
0

Hello folks,

I am trying to setup a simple Start-Job command.  This basic command works for me and copies the file correctly.

Start-Job -Scriptblock {Copy-Item -Path \\192.168.32.25\share\butterfly.jpg -Destination c:\test\ -Recurse -Verbose}

However, it does not work when I try using variable like this.

$source = "\\192.168.32.25\share\butterfly.jpg"

$target = "c:\test\"

Start-Job -Scriptblock {Copy-Item -Path $source -Destination $target -Recurse -Verbose}

Anyone have suggestions for getting this to work with variables?

Thanks,

romatlo



How to move selection based on word outline?

$
0
0

Hello everyone,

I am trying to write a script for adding TAGs as comment into word document. The idea is to add a tag for every heading and sub-heading present in document. The input word documents do not have 'word style' followed. I have following two questions.

1.) How can I extract number of headings based on outline? The document do not use word styles for adding headings or sub-headings. This makes it difficult to use 'outlineLevel' to be used. As if a heading is written in normal text then outlineLevel will return '10' and script will miss this heading. I read on another forum that outlineNumber can be used but it does not seem to be working with paragraph object.

2.) How to move selection from one heading to next? Currently my script is not able to move selection.

Below is the script I manage to write. (I'm new to scripting and this is my first script)

$filePath = "H:\Desktop\ashishk\F1K\FunctionalSafetyCopy.docx"

$word = New-Object -comobject word.application

$word.visible = $false
$MinDepth = 1
$MaxDepth = 9
$TagPrefix = "TS_FS_"
$TagStart = 1
$TagStep = 1
$TagNew = 0
#Document object
$doc = $word.documents.open($filePath)


$section = $doc.sections.item(1)
$range = $section.Range
$outline = $doc.Paragraphs | ForEach-Object {
   if($_.outlineLevel -le $MaxDepth){
      Write-Host "outlineLevel:" $_.outlineLevel
     if($TagNew -eq 0){
          $_.Comments.Add($range, "$TagPrefix$TagStart")
          $TagNew = $TagStart + $TagStep
          Write-Host "New Tag number:" $TagNew
     }
     Else{

        $doc.Comments.Add($range, "$TagPrefix$TagNew")
        $TagNew = $TagNew + $TagStep
        Write-Host "New Tag number:" $TagNew
     }
   }
}
$doc.save()

$doc.close()

$word.quit()


WIN32_DiskDrive Shows same SerialNumber for same Mfgr but different models

$
0
0

We're trying to gather the serial numbers for all USB drives plugged into our users' workstations, but have run into a snag. The same serial number is being reported for different model drives and on different workstations. I've searched and searched trying to find an answer, but as the serial number is supposedly generated by the mfgr, is this something that is distinctly done by say Samsung?  Any suggestion would be greatly appreciated. TIA..

Windows 7, Tried both 64 and 32 bit Powershell, UAC set/not set

GWMI -ComputerName 8LC4FQ1 -Class WIN32_DiskDrive -EnableAllPrivileges | select PSComputerName,Name,Model,SerialNumber

GWMI -ComputerName 3410SYK -Class WIN32_DiskDrive -EnableAllPrivileges | select PSComputerName,Name,Model,SerialNumber

(e.g.)

PSComputerName  Name                        Model                                         SerialNumber                            
--------------             ----                            -----                                            ------------                            
8LC4FQ1                \\.\PHYSICALDRIVE0  WDC WD2500AAJS-75M0A0        W -DMWVAH29E9280                   
8LC4FQ1                \\.\PHYSICALDRIVE1  SAMSUNG HM160HI USB Device  152D20329000                           

3410SYK                 \\.\PHYSICALDRIVE0  WDC WD5000AAKX-60U6AA0     W -DCW2CPE1W5037                   
3410SYK                 \\.\PHYSICALDRIVE1  SAMSUNG HM320JX USB Device  152D20329000

Unable to PS Remote from Workgroup server to a server Joined on Domain

$
0
0

Hi All,

We are trying to do a Power shell remote from a server which is in workgroup to a server which is joined to Domain.

The account used to connect is a domain account, we have enable winrm on the client (domain joined server) with Enable-PSremoting –force command, added * to trusted host on both the workgroup and domain server. added exception on the windows firewall. Added the domain account to Wmi Namespace with full control

Telnet works fine for the port 5985

We use the below command to ps remote to client (domain joined server).

Enter-PSSession -ComputerName hostname -Credential domain\domainaccount

when we do a ps remote from workgroup server to client (domain Joined server)  , we are getting "access denied" error . Also if we login to client (domain joined server) with the domain account which we use for ps-remote and then try to do a ps-remote from workgroup server, it works fine.

so ps-remote is only working when login to a client machine with a domain account and do the ps-remote from server with that account. 

both the client (domain server) and server (workgroup) runs windows server 2012 R2

Please help us in resolving this issue.

Update printer properties with powerhsell error

$
0
0

Hello, dear Colleagues.

I'm trying to updates properties with powershell.

Here is a script:

$erroractionpreference = "continue"
$colPrinters = Get-Wmiobject -Class win32_printer -computername print_server  -Filter "Name like 'printer1' or Name like 'printer2' or Name like 'printer3' or Name like 'printer4' or Name like 'printer5' or Name like 'printer6'"  # get printers on server and filter with names
        ForEach ($objPrinter in $colPrinters) { # get printer details from WMI
            If ($objPrinter.RawOnly -ne "True") { # check that Advanced printing fetaures is turned on
                Write-host $objPrinter.Name
                Write-Host $objPrinter.RawOnly
                $objPrinter.RawOnly = "True"  # Untick and update the object in WMI
                $objPrinter.Put()
            }
        } 

It works on Windows 7 workstation, but does not on print server Windows Server 2012 R2 with error:

Exception calling "Put" with "0" argument(s): "Generic failure "
At \\print_server\c$\DisableAdvancedPrintingFeatures.ps1:8 char:17+                 $objPrinter.Put()+                 ~~~~~~~~~~~~~~~~~+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : DotNetMethodException

Can you help me with that?

Thanks you.


Remote PS and Local Drives

$
0
0

Hi All,

Quick question with PS Remoting.

In my script, i start a remote PS session with:

$global:ps_fs_sess = New-PSSession $ps_fs -Authentication Kerberos -Credential $global:ps_cred -ErrorAction Stop

Enter-PSSession $global:ps_fs_sess

Then i try to reference local drives on the remote server with:

$ps_fs_acl = Get-Acl "D:\Users\testuser"

But i get an error saying "Cannot locate drive D"

Now, if i end the script here my ISE shows as being connected to the remote server and i can manually reference the D drive..

Any comments or thoughts?



How to update the Client DNS settings with powershell script

$
0
0

Guys,

need small help basically what i am trying to do here run dcdiag /e/test:dns  on remote forestget the bad ip from text file  and then remove them from domain controller nics. the problem is the script works fine when there is single ip but when there is more than one ip it doesn't work

output of text file :


                  invalid DNS server: 10.18.134.69 (<name unavailable>)
                  invalid DNS server: 10.18.134.69 (<name unavailable>)
                  invalid DNS server: 10.18.134.69 (<name unavailable>)
                  invalid DNS server: 10.18.134.69 (<name unavailable>)
                  invalid DNS server: 25.176.13.170 (<name unavailable>)
                  invalid DNS server: 25.176.13.165 (<name unavailable>)
            DNS server: 10.18.134.69 (<name unavailable>)
            DNS server: 25.176.13.165 (<name unavailable>)
            DNS server: 25.176.13.170 (<name unavailable>)

Script 

$FOREST = iNNERSPACE.LOCAL
          $server = Get-ADDomainController -DomainName $forest -Discover -Service ADWS |select -ExpandProperty hostname
         $findip= Invoke-Command -ComputerName $server -ScriptBlock {dcdiag /e /test:dns } -Credential $cred 
         $findip | Select-String -SimpleMatch   "(<name unavailable>)" |Out-File ipaddres.txt
         $var = Get-Content .\ipaddres.txt


         #extract ip from the text File 
         $regex = [regex] "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
         $ip= $regex.matches($var) |Select-Object  -ExpandProperty value -Unique
    
         write-host "$ip" is the bad ip -ForegroundColor Yellow 
            #ip To remove from the dns client settings
            
          $ipToFind = '$ip'

        function Update-DNS 
          {

         $nicDetails = Get-WmiObject Win32_NetworkAdapterConfiguration -comp $strComputer -Filter 'IPEnabled=True' -ErrorAction Stop -Credential $cred
         foreach ($nic in $nicDetails) {
          If ($nic.DNSServerSearchOrder -contains $ipToFind) {

               $strDNSServers=@()
               $nic.DNSServerSearchOrder|foreach
               {

                if($_ -ne $ipToFind){ $strDNSServers+=$_ }

               }
                                                                       
                $nic.SetDNSServerSearchOrder($strDNSServers) | out-null}
            }
        }

       $Domaincontrollers =Get-ADDomainController -Server $server -Filter * |select -ExpandProperty hostname 

        foreach ($strComputer in $Domaincontrollers)
        {
       write-host "working on $strcomputer"
           Update-DNS 
        }



How to Use .CSV file in a power shell script

$
0
0

Greetings all,<o:p></o:p>

I am new to powershell and I am wondering if someone can help me. This is the situation. I have migrated over 3000 users to Exchange from Lotus Notes. These users came from a trusted AD domain. Now I want to grant access to an individual mailbox from the user account from the other domain. I have .csv file that has Exchange EMail Address, DomainA\UserName and DomainXYZ\UserName. I need a script example where the script read this .csv, access the user outlook mailbox and grant right to DomainXYZ\UserName. So it should run the following command<o:p></o:p>

get-mailbox -identity UserName01@DomainA.com  | add-mailboxpermission -user "DomainXYZ\UserName01         " -accessrights 'fullaccess'<o:p></o:p>

 

Thanks  a lot.

This is the .CSV file<o:p></o:p>

DomainA\UserName01                           DomainXYZ\UserName01                       UserName01@DomainA.com <o:p></o:p>

DomainA\UserName02                           DomainXYZ\UserName02                       UserName02@DomainA.com <o:p></o:p>

------------------------                           -------------------------                         ---------------------------<o:p></o:p>

------------------------                           -------------------------                         ---------------------------<o:p></o:p>

DomainA\UserName2999                    DomainXYZ\UserName2999                UserName2999@DomainA.com<o:p></o:p>

DomainA\UserName3000                  DomainXYZ\UserName3000                 UserName3000@DomainA.com
<o:p></o:p>



ow to change the color of row in Datagrid view

$
0
0

How to change the color of row in Datagridview. Eg. Am getting a remote server services by get-service.  I want to change the color of services that are not running. Am using the below function to get the services.

Please help me it would be useful

    

function Get-SystemInfo
{

    $array = New-Object System.Collections.ArrayList
$Script:SystemInfo = Get-WmiObject win32_service -ComputerName $textbox1Computername.text | select DisplayName,Name,state,status,startmode | Sort-Object state,startmode,DisplayName
$array.AddRange($SystemInfo)
$datagridview1.DataSource = $array

}


Get-Content and add Date and Time in a new file

$
0
0

Hello,

in a existing file I have data like:

1;Idle
5;chrome
1;spoolsv

Now I need to grab the content and add date and time in front of each line and save it to another file like:

07.04.2015;10:18;1;Idle
07.04.2015;10:18;5;chrome
07.04.2015;10:18;1;spoolsv

But I don't have any idea how I could solve this challange. Does anyone have a helping hand for me?


Greetings

Exporting just username(s) from query session

$
0
0

Hi all,

Just wondering how to export just the username from: query session /server:"server"

When the results come out like this:  

SESSIONNAME      USERNAME             ID  STATE   TYPE        DEVICE

 rdp-tcp#0           test                         2  Active   

I just want the results form the username column

I need just the users to add an extra field into this code:

$CSV = @""Name","Operating System","Description""DC01","Windows Server 2008 R2","Domain Controller""DC02","Windows Server 2012 R2","Domain Controller""@
$Servers = ConvertFrom-Csv $CSV
$Servers | Out-GridView -Title "Select a server" -PassThru | Select Name |
    %{Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "/v:$($_.Name)"}

Once I can get the usernames ill add a "username" field. We can then use this to select a server, get description and see who/if anyone is logged into the server.

Thanks for any help with this.



need help about get-command

$
0
0

hi friends

i know via Get-command *adapter*, we can list all commands which contain the word "adapter"

but how to get the list of all commands which contain the word "net" or the word "adapter" or contain both?

thanks

Scheduled Task only fails to print when user not logged in

$
0
0
   

Setting the stage:
I am trying to print pdf reports to a networked printer from a scheduled task at 6am daily.  I have a Powershell 2.0 script on WIndows 2008 R2 that checks for a trigger file with a path to the folder the pdf reports are in and then iterates over the files looking for 3 specific files to print and then prints them to the default printer which is an installed network printer.  This task is set to run "whether the user is logged in or not" and is set "to run with the highest privileges".  It is set to run under a service account with admin access that was also the user that installed the printer.  The code used to print to the default printer is:

Start-Process -FilePath "$archivePath\$($pdf.Name)" -Verb Print  

The Problem:
The issue I am having is that the process only actually prints if the user is logged into the server.  Everything else works, the logging the opening of the pdf in adobe reader, everything.  It just will not send the report to the printer.  If I log in at 5:55am and watch the process and the print spooler I can see everything work, however if I log in at 6:01am I can see the processes running in task manager and track the log but the reports never get sent to the printer.
What I have tried:
I have tried to run this from a bat script that self elevated the powershell in the hopes it was a permission issue using:

SET PowerShellScriptPath=D:\Scripts\Print_HFM_Reports.ps1START /WAIT PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File "%PowerShellScriptPath%"' -Verb RunAs}";

I am not sure what else to check or change.  I am not getting any errors in the event viewer or anywhere else.  The Print just doesn't work and right now my only option is to get up at 5:45 and log in.

How do I assign my SQL result as a variable?

$
0
0

I have some sql in powershell that returns a flag (0,1) and I was wondering how I can assign just thisprocess_flag as a variable so I can use it for the next part of the script.

$dSQL=" SELECT MAX(updated_at) source_updated_at, MAX(created_at) target_created_at, CASE WHEN ((MAX(created_at) < MAX(updated_at)) or (MAX(created_at) IS NULL

AND MAX(updated_at) IS NOT NULL)) THEN 1 ELSE 0 END process_flag FROM (SELECT MAX(ds.updated_at) updated_at, NULL created_at FROM datasources ds, sites si WHERE ds.site_id = si.id AND si.url_namespace = '$ParentURL' AND ds.repository_url = '$RepoURL' UNION SELECT NULL, MIN(ds.created_at) created_at FROM datasources ds, sites si WHERE ds.site_id = si.id AND si.url_namespace = '$TargetURL' AND ds.repository_url = '$RepoURL$DupeSuffix' ) A "


Thank you for your time.


Export multivalued attribute to CSV

$
0
0

Hello all, i'm having an issue exporting the dept number to a csv file.  department number shows in the powershell output but when using export-csv the department number shows as

Microsoft.ActiveDirectory.Management.ADPropertyValueCollection

Here is my script.
Get-Content "L:\Scripts\Ad Lists\Users.txt" | Get-ADUser -properties departmentnumber | Select-Object Name,SamAccountName,Departmentnumber | Export-Csv "L:\Scripts\Ad Lists\userdeptno.csv"

A quick google search, says to use the join function. so i changed  the script to
Get-Content "L:\Scripts\Ad Lists\Users.txt" | Get-ADUser -properties departmentnumber | Select-Object Name,SamAccountName,@{Name='departmentnumber';Expression={[string]::Join(";",($.departmentnumber))}}

Now the department number is blank in both the powershell output and the .csv file.  Any help would be appreciated.

Powershell, Exchange 2010 - Sent and Received emails by domain to CSV

$
0
0

I think I almost have what I want but I can't figure out the last bits.  Hoping someone can help.

This code does produce the results I want but I would prefer to have EventID send or EventID Receive in one line but can't figure out how to get the syntax correct.  The result would then provide the actual total I'm looking for rather than having the results in 2 files.  

Get-MessageTrackingLog -Start (Get-Date).AddDays(-1) -ResultSize Unlimited  -EventID receive | Select -Expand Recipients | Group { (($_).Split("{@}"))[1]  } |select-object 'Name', 'Count' |export-csv c:\temp\Received.csv
Get-MessageTrackingLog -Start (Get-Date).AddDays(-1) -ResultSize Unlimited -EventID send | Select -Expand Recipients | Group { (($_).Split("{@}"))[1]  } |select-object 'Name', 'Count' |export-csv c:\temp\sent.csv

Also, how do you get rid of the quotes "" in the csv file??

Thanks



Syncronet

how to get a value from an object

$
0
0

Here is the concept of something I want to do in PowerShell:

$exp = get-process explorer | select *
$pms64 = get_value( $exp, PagedMemorySize64 )

As I see it, the value would be available to use.  Using that technique I could get other values then order them to write to a log file. How should I do this? 

Please make the answer as simple as possible.  What search term can I use to find a tutorial on this topic?


~jag77 We need to know what a dragon is before we study its anatomy. (Bryan Kelly, 2010)


Changing the names of multiple computers in a domain with a PS script

$
0
0

I have approximately 13 computers i need to change the name of for a new naming convention. I have created a .csv file for old and new name. I followed the below from technet:

PS C:\>$a = Import-Csv ServerNames.csv -Header OldName, NewName
PS C:\>Foreach ( $Server in $a ) {Rename-Computer -ComputerName $Server.OldName -NewName $Server.NewName -DomainCredential Domain01\Admin01 -Force -Restart}

However, it does not seem to recongize the command. I am running 4.0. And i'm wondering if its becaue i dont understand the variable "$Server in $a". That is where it appears the error is reported by PS. I'm brand new to scripting. I just want to stand out amongst others. Please assist in anyway possible. Thanks.

Multiselecting files

$
0
0

Hi,

I am trying to select multiple files in a form. From the dyalog, I select effectively multiple files but the script is returning only one file in the text box. Am I missing something?

#----------------------------------------------
#region Application Functions
#----------------------------------------------

function OnApplicationLoad {
	#Note: This function is not called in Projects
	#Note: This function runs before the form is created
	#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
	#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
	#Important: Form controls cannot be accessed in this function
	#TODO: Add modules and custom code to validate the application load

	return $true #return true for success or false for failure
}

function OnApplicationExit {
	#Note: This function is not called in Projects
	#Note: This function runs after the form is closed
	#TODO: Add custom code to clean up and unload modules when the application exits

	$script:ExitCode = 0 #Set the exit code for the Packager
}

#endregion Application Functions

#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Call-test_psf {

	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load('mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[void][reflection.assembly]::Load('System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[void][reflection.assembly]::Load('System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[void][reflection.assembly]::Load('System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[void][reflection.assembly]::Load('System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
	[void][reflection.assembly]::Load('System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[void][reflection.assembly]::Load('System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
	[void][reflection.assembly]::Load('System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[void][reflection.assembly]::Load('System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$form1 = New-Object 'System.Windows.Forms.Form'
	$buttonBrowse = New-Object 'System.Windows.Forms.Button'
	$textboxFile = New-Object 'System.Windows.Forms.TextBox'
	$openfiledialog1 = New-Object 'System.Windows.Forms.OpenFileDialog'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------

	$buttonBrowse_Click={

		if($openfiledialog1.ShowDialog() -eq 'OK')
		{
			$textboxFile.Text = $openfiledialog1.FileName
		}
	}

	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------

	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$form1.WindowState = $InitialFormWindowState
	}

	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$buttonBrowse.remove_Click($buttonBrowse_Click)
			$form1.remove_Load($form1_Load)
			$form1.remove_Load($Form_StateCorrection_Load)
			$form1.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch [Exception]
		{ }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	$form1.SuspendLayout()
	#
	# form1
	#
	$form1.Controls.Add($buttonBrowse)
	$form1.Controls.Add($textboxFile)
	$form1.ClientSize = '862, 448'
	$form1.Name = "form1"
	$form1.Text = "Form"
	$form1.add_Load($form1_Load)
	#
	# buttonBrowse
	#
	$buttonBrowse.Location = '383, 110'
	$buttonBrowse.Name = "buttonBrowse"
	$buttonBrowse.Size = '30, 23'
	$buttonBrowse.TabIndex = 1
	$buttonBrowse.Text = "..."
	$buttonBrowse.UseVisualStyleBackColor = $True
	$buttonBrowse.add_Click($buttonBrowse_Click)
	#
	# textboxFile
	#
	$textboxFile.AutoCompleteMode = 'SuggestAppend'
	$textboxFile.AutoCompleteSource = 'FileSystem'
	$textboxFile.Location = '149, 112'
	$textboxFile.Name = "textboxFile"
	$textboxFile.Size = '228, 20'
	$textboxFile.TabIndex = 0
	#
	# openfiledialog1
	#
	$openfiledialog1.DefaultExt = "txt"
	$openfiledialog1.Filter = "Text File (.txt)|*.txt|All Files|*.*"
	$openfiledialog1.Multiselect = $True
	$openfiledialog1.ShowHelp = $True
	$form1.ResumeLayout()
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $form1.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$form1.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$form1.add_FormClosed($Form_Cleanup_FormClosed)
	#Show the Form
	return $form1.ShowDialog()

} #End Function

#Call OnApplicationLoad to initialize
if((OnApplicationLoad) -eq $true)
{
	#Call the form
	Call-test_psf | Out-Null
	#Perform cleanup
	OnApplicationExit
}

Thanks,

Viewing all 21975 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>