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

Powershell Script - GPO Security FIlter Computer

$
0
0

Setting GPO security filter with powershell (add delete computers)


I've been looking for a powershell script that can add a .csv file of servers to my previous configured GPO.

The case is that we constantly add new machines and because security groups of computers don't cut the chase (the policies don't get applied) I wanted a powershell to add a list of machines to my current GPO.

The trick is that it should delete first the current security filtering and then add the machines listed in the csv file.

Any help will be welcome.


Delete files older than and create a log of which files were deleted

$
0
0

Hi!

I am using a simple script to delete files older than 30 days on a file share folder. I am new to powershell....how can I add to the script to make it create a log file of which files were deleted and have that log stored in a folder?

$limit = (Get-Date).AddDays(-30)
$path = "Z:\Katie"

# Delete files older than the $limit.
Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force

# Delete any empty directories left behind after deleting the old files.
Get-ChildItem -Path $path -Recurse -Force | Where-Object { $_.PSIsContainer -and (Get-ChildItem -Path $_.FullName -Recurse -Force | Where-Object { !$_.PSIsContainer }) -eq $null } | Remove-Item -Force -Recurse

Read a column from a file and compare it.

$
0
0

Hi everyone!

  I need to read a column from a file and compare to a column on a second file:

--

  param([string]$path=$(Throw "Parameter missing: -name Path"))

  Get-ChildItem -Path $path -File -Recurse | Get-FileHash -Algorithm MD5 | Select-Object -Property Hash,Path | Export-Csv -Path .\tempfile1.csv -NoTypeInformation
  Get-ChildItem -Path $path -File -Recurse | Get-FileHash -Algorithm MD5 | Select-Object -Property Hash,Path | Group-Object -Property Hash -NoElement | Where-Object {$_.count -gt 1} | Sort-Object -Property Count -Descending | Export-Csv -Path .\tempfile2.csv -NoTypeInformation

  $file1=Get-Content -Path .\tempfile1.csv 
  $file2=Get-Content -Path .\tempfile2.csv

  foreach($line1 in $file1)
  {
    foreach($line2 in $file2)
    {
       if($line1.Hash -eq $line2.Name)
      {
         # Work here
         Write-Host $line1.Path
      }
    }
    Write-Host ------- -ForegroundColor Yellow
    Write-Host ""
  }

  Perhaps, the output shows me nothing:

--

-------



-------



-------



-------

  May someone help me how to identity correctly a column from a file?

Thanks.


Doria

Overwrite ntfs permissions

$
0
0

Hi All,

I have about 10,000 files for which i need to overwrite permissions. Meaning to say, there are 'n' number of people having access on those files. Not sure who are all having the access. I would like to remove them all and have only myself access those files. I would also want to hide those files within the same path.

Could anyone help? Much appreciated..!

Thank You

Function not recognized

$
0
0

I have a function defined in my script that I want to process a creation of an HTML page based upon various logical steps. There will be no parameters being passed to this function

function CreateHTMLPage
{
	Block of code
}

I have a line in my script that calls the function, but I am getting an error that it is not recognized...

CreateHTMLPage

I have tried several suggestions from other web pages, but I still cannot seem to get this to work properly.

Set-SqlColumnEncryption : Object reference not set to an instance of an object

$
0
0

Hi,

I am running following on one server (windows 2016) with SQL Server 2016 and it works fine, same commend on another server (windows 2016) but SQL 2017 gives the error as below, Column Master Key and Column Encryption Key does exist on both servers, I have imported latest (SqlServer 21.1.18080) module from powershell gallery, please help

Also, I can encrypt the column using SSMS wizard on same server where I can't using powershell  script in elevated mode...if that helps...

PS CODE:

Import-Module SqlServer 

$sqlConnectionString = "Data Source=server1\dw;Initial Catalog=DW;Integrated Security=True;MultipleActiveResultSets=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;Packet Size=4096;Application Name=`"Microsoft SQL Server Management Studio`""
$smoDatabase = Get-SqlDatabase -ConnectionString $sqlConnectionString

$encryptionChanges = @()
$encryptionChanges += New-SqlColumnEncryptionSettings -ColumnName dbo.Emp.First_Name -EncryptionType Randomized -EncryptionKey "ColEncrypKey"

Set-SqlColumnEncryption -ColumnEncryptionSettings $encryptionChanges -InputObject $smoDatabase 

ERROR:

Set-SqlColumnEncryption : Object reference not set to an instance of an object.
At line:10 char:1
+ Set-SqlColumnEncryption -ColumnEncryptionSettings $encryptionChanges  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-SqlColumnEncryption], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.SqlServer.Management.PowerShell.AlwaysEncrypted.SetColumnEncryption

Thanks



Pass an array as a parameter

$
0
0

I've got a script I'm working on with a MS program's PS Module.  I've got one array that is holding a series of names in a domain\user format and am trying to pass it to a command  it gives me an odd error message.  

Command:

remove-CrmDeploymentAdministrator -name $dropadmin

Error:

remove-CrmDeploymentAdministrator : Cannot convert 'System.String[]' to the type 'System.String' required by the parameter 'Name'.  Specified method is not supported.  

I'm not sure what the best solution here is and if there is a nuance to the way it is mentioning those strings that I need to run some sort of convert on the array values before I'm going to be able to pass them to the command.  

Thanks!

Add a Property to a PSObject only if it has a value (exists)

$
0
0

Hello Guys,

I need some advises on how to add a property to an existing PSObject, but only if the property has a value. For example:

$OutObj = New-Object -TypeName PSObject
Add-Member -InputObject $OutObj -Type noteproperty -Name Id -Value $Id
Add-Member -InputObject $OutObj -Type noteproperty -Name Name -Value $Name
Add-Member -InputObject $OutObj -Type noteproperty -Name Group -Value $group


What I would like to achieve is adding the property only if it has a value. So far I did a check of every single property and if it exists I add it to the object...something like:

if ($Id) {
Add-Member -InputObject $OutObj -Type noteproperty -Name Id -Value $Id
}

but I find this a bit uncool when the number of properties rises. 

Any ideas how to optimize this?

Thanks!



Powershell getElementById() not working with IE11‏

$
0
0

Dear Microsoft,

I was reading the MSDN article article Web UI Automation with Windows PowerShell. When I am testing the script of DOM manipulation I found that the getElementbyID() method could not work under IE11.

With some search, there is another StackOverflow article getElementById does not seem to work in IE10 seems to suggest the same.

Is this due to some news security restrictions imposed by the new IE? Based on the original contents of the article, can any modification be made to make the Powershell snippets work with IE11?

Bob

  

Output rows that have blank value

$
0
0
Hi Experts,

 I am trying to output rows in a CSV file that has null values in a particular column. "DAT Version" is the name of the column in this case.Could you please advice.Thank you. 

$DataFileLocation = "\\servername\d$\reports\dailyreport.csv"
$file = import-csv $DataFileLocation


$file  | Where-Object {"$_.DAT Version" -eq 'NULL'} | Select-Object "System Name" , "IP Address"


PowerShell Forms - Textbox Input Check - Forward Content to a new Form

$
0
0

Hello Everyone,

I am struggling with a form, in combination with a Textbox and data entered into it. I started to build a test script that works as shown in example 1 and then extended it and need to do some minor changes to make it work.

In example 1: I generate a Form, ask for a Name and after a data input and pressing OK, a second form opens to present the data in a label. That works fine and I would like to have it on such way.

CLS
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

#New User Form
$TestForm = New-Object System.Windows.Forms.Form
$TestForm.Text = "Test Name Input"
$TestForm.AutoScroll = $True
$TestForm.AutoSizeMode = "GrowAndShrink"
$TestForm.MinimizeBox = $True
$TestForm.MaximizeBox = $True
$TestForm.WindowState = "Normal"
$TestForm.Size = New-Object System.Drawing.Size(1000,1000)
$TestForm.StartPosition = 'CenterScreen'


#New User Form Title
$TestFormTitle = New-Object System.Windows.Forms.Label
$TestFormTitle.Location = New-Object System.Drawing.Point(10,30)
$TestFormTitle.Size = New-Object System.Drawing.Size(450,50)
$TestFormTitleFont = New-Object System.Drawing.Font("Times New Roman",26,[System.Drawing.FontStyle]::Bold)
$TestFormTitle.Font = $TestFormTitleFont
$TestFormTitle.Text = "This is a Test"
$TestForm.Controls.Add($TestFormTitle)

#New User Form Label Firstname
$TestFormFormLabelFirstname = New-Object System.Windows.Forms.Label
$TestFormFormLabelFirstname.Location = New-Object System.Drawing.Point(10,100)
$TestFormFormLabelFirstname.Size = New-Object System.Drawing.Size(885,40)
$TestFormFormLabelFirstnameFont = New-Object System.Drawing.Font("Arial",16,[System.Drawing.FontStyle]::Italic)
$TestFormFormLabelFirstname.ForeColor = "DarkBlue"
$TestFormFormLabelFirstname.Font = $TestFormFormLabelFirstnameFont
$TestFormFormLabelFirstname.Text = "Please Enter Firstname"
$TestForm.Controls.Add($TestFormFormLabelFirstname)

#New User Form Textbox Firstname
$TestFormTextBoxFirstname = New-Object System.Windows.Forms.TextBox
$TestFormTextBoxFirstname.Location = New-Object System.Drawing.Point(10,140)
$TestFormTextBoxFirstname.Size = New-Object System.Drawing.Size(885,100)
$TestFormTextBoxFirstnameFont = New-Object System.Drawing.Font("Arial",20,[System.Drawing.FontStyle]::Italic)
$TestFormTextBoxFirstname.Font = $TestFormTextBoxFirstnameFont
$TestForm.Controls.Add($TestFormTextBoxFirstname)

#Create OK Button
$OKButton = New-Object System.Windows.Forms.Button
$OKButton.Location = New-Object System.Drawing.Point(190,860)
$OKButton.Size = New-Object System.Drawing.Size(200,75)
$OKButton.Font = New-Object System.Drawing.Font("Arial",16,[System.Drawing.FontStyle]::Regular)
$OKButton.Text = 'OK'               
$OKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK           
$TestForm.AcceptButton = $OKButton
$TestForm.Controls.Add($OKButton)           


$result = $TestForm.ShowDialog()

#Confirmation Name Form
$ConfirmatonNameform = New-Object System.Windows.Forms.Form
$ConfirmatonNameform.Text = "Confirmation Name"
$ConfirmatonNameform.Size = "1300, 780"
$ConfirmatonNameform.StartPosition = "CenterScreen"
$ConfirmatonNameform.Icon = $ConfirmatonNewUserformIcon
$ConfirmatonNameform.AutoSize = $False
$ConfirmatonNameform.BringToFront()

#Confirmation New User Firstname Label
$ConfirmatonNameLabel = New-Object System.Windows.Forms.Label
$ConfirmatonNameLabel.Location = New-Object System.Drawing.Point(10,80)
$ConfirmatonNameLabel.Size = New-Object System.Drawing.Size(200,50)
$ConfirmatonNameLabelFont = New-Object System.Drawing.Font("Times New Roman",18,[System.Drawing.FontStyle]::Regular)
$ConfirmatonNameLabel.ForeColor = "DarkBlue"
$ConfirmatonNameLabel.Font = $ConfirmatonNameLabelFont
$ConfirmatonNameLabel.Text = "Firstname:"
$ConfirmatonNameform.Controls.Add($ConfirmatonNameLabel)

#Confirmation New User Firstname Data
$ConfirmatonNamevar = New-Object System.Windows.Forms.Label
$ConfirmatonNamevar.Location = New-Object System.Drawing.Point(400,80)
$ConfirmatonNamevar.Size = New-Object System.Drawing.Size(700,50)
$ConfirmatonNamevarFont = New-Object System.Drawing.Font("Times New Roman",18,[System.Drawing.FontStyle]::Regular)
$ConfirmatonNamevar.ForeColor = "Black"
$ConfirmatonNamevar.Font = $ConfirmatonNamevarFont
$ConfirmatonNamevar.text = $TestFormTextBoxFirstname.text
$ConfirmatonNameform.Controls.Add($ConfirmatonNamevar)



if ($result -eq [System.Windows.Forms.DialogResult]::OK)
{$ConfirmatonNameform.ShowDialog()}

I have extended this form and because I have several Textboxes, I wanted to have a mechanism, to prevent a textbox left-out without any data entered.

In example 2 you can see how the code looks slightly different.

CLS
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

#New User Form
$TestForm = New-Object System.Windows.Forms.Form
$TestForm.Text = "Test Name Input"
$TestForm.AutoScroll = $True
$TestForm.AutoSizeMode = "GrowAndShrink"
$TestForm.MinimizeBox = $True
$TestForm.MaximizeBox = $True
$TestForm.WindowState = "Normal"
$TestForm.Size = New-Object System.Drawing.Size(1000,1000)
$TestForm.StartPosition = 'CenterScreen'


#New User Form Title
$TestFormTitle = New-Object System.Windows.Forms.Label
$TestFormTitle.Location = New-Object System.Drawing.Point(10,30)
$TestFormTitle.Size = New-Object System.Drawing.Size(450,50)
$TestFormTitleFont = New-Object System.Drawing.Font("Times New Roman",26,[System.Drawing.FontStyle]::Bold)
$TestFormTitle.Font = $TestFormTitleFont
$TestFormTitle.Text = "This is a Test"
$TestForm.Controls.Add($TestFormTitle)

#New User Form Label Firstname
$TestFormFormLabelFirstname = New-Object System.Windows.Forms.Label
$TestFormFormLabelFirstname.Location = New-Object System.Drawing.Point(10,100)
$TestFormFormLabelFirstname.Size = New-Object System.Drawing.Size(885,40)
$TestFormFormLabelFirstnameFont = New-Object System.Drawing.Font("Arial",16,[System.Drawing.FontStyle]::Italic)
$TestFormFormLabelFirstname.ForeColor = "DarkBlue"
$TestFormFormLabelFirstname.Font = $TestFormFormLabelFirstnameFont
$TestFormFormLabelFirstname.Text = "Please Enter Firstname"
$TestForm.Controls.Add($TestFormFormLabelFirstname)

#New User Form Textbox Firstname
$TestFormTextBoxFirstname = New-Object System.Windows.Forms.TextBox
$TestFormTextBoxFirstname.Location = New-Object System.Drawing.Point(10,140)
$TestFormTextBoxFirstname.Size = New-Object System.Drawing.Size(885,100)
$TestFormTextBoxFirstnameFont = New-Object System.Drawing.Font("Arial",20,[System.Drawing.FontStyle]::Italic)
$TestFormTextBoxFirstname.Font = $TestFormTextBoxFirstnameFont
$TestForm.Controls.Add($TestFormTextBoxFirstname)

#Create OK Button
$OKButton = New-Object System.Windows.Forms.Button
$OKButton.Location = New-Object System.Drawing.Point(190,860)
$OKButton.Size = New-Object System.Drawing.Size(200,75)
$OKButton.Font = New-Object System.Drawing.Font("Arial",16,[System.Drawing.FontStyle]::Regular)
$OKButton.Text = 'OK'               
$TestForm.AcceptButton = $OKButton
$TestForm.Controls.Add($OKButton)           

#Check if Name has been entered
$OKButtonClickEvent = (
    {if (!$TestFormTextBoxFirstname.text -and !$TestFormTextBoxFirstname.text -eq 'True') {[System.Windows.MessageBox]::Show('No data entered in Firstname','Ooops','OK','Warning')}
            Else {$TestForm.Hide(),$ConfirmationNameform.ShowDialog()}
    }
)

$OKButton.Add_Click($OKButtonClickEvent) 
$TestForm.ShowDialog()


#Confirmation Name Form
$ConfirmationNameform = New-Object System.Windows.Forms.Form
$ConfirmationNameform.Text = "Confirmation Name"
$ConfirmationNameform.Size = "1300, 780"
$ConfirmationNameform.StartPosition = "CenterScreen"
$ConfirmationNameform.Icon = $ConfirmationNewUserformIcon
$ConfirmationNameform.AutoSize = $False
$ConfirmationNameform.BringToFront()

#Confirmation New User Firstname Label
$ConfirmationNameLabel = New-Object System.Windows.Forms.Label
$ConfirmationNameLabel.Location = New-Object System.Drawing.Point(10,80)
$ConfirmationNameLabel.Size = New-Object System.Drawing.Size(200,50)
$ConfirmationNameLabelFont = New-Object System.Drawing.Font("Times New Roman",18,[System.Drawing.FontStyle]::Regular)
$ConfirmationNameLabel.ForeColor = "DarkBlue"
$ConfirmationNameLabel.Font = $ConfirmationNameLabelFont
$ConfirmationNameLabel.Text = "Firstname:"
$ConfirmationNameform.Controls.Add($ConfirmationNameLabel)

#Confirmation New User Firstname Data
$ConfirmationNamevar = New-Object System.Windows.Forms.Label
$ConfirmationNamevar.Location = New-Object System.Drawing.Point(400,80)
$ConfirmationNamevar.Size = New-Object System.Drawing.Size(700,50)
$ConfirmationNamevarFont = New-Object System.Drawing.Font("Times New Roman",18,[System.Drawing.FontStyle]::Regular)
$ConfirmationNamevar.ForeColor = "Black"
$ConfirmationNamevar.Font = $ConfirmationNamevarFont
$ConfirmationNamevar.text = $TestFormTextBoxFirstname.text
$ConfirmationNameform.Controls.Add($ConfirmationNamevar)


The ClickEvent (thanx jrv) checks if data has been entered and if not, will give a warning. This also works perfectly and I was happy but then, I faced a new problem:

As soon as the second form opens, for some reason, the content of the textbox in the example called "$TestFormTextBoxFirstname.text" is empty.

What I was able to find out is, that if I run the Script a second time, I get the UserInput from the first try and if I understand correctly, that means, that the name entered in example 2 and stored as a variable, runs through without being forwarding to the second form to "$ConfirmationNamevar.text". I was playing around, trying different approaches but was not able to fix it.

I tried this approach, because I had no clue, how to show "$TestFormTextBoxFirstname.text" directly in the Label. Here,  I also tried several ways but failed also.

What am I doing wrong? Can someone help with a solution, so I can keep the ClickEvent and have the content of the Textbox transferred into the Second Form, so the name is shown, as it works correctly in example 1?

Thank you very much for your help,

Mike

Applying Multiple conditions for each row in CSV file

$
0
0

Hi Experts,

I am trying to extract rows only if both the conditions are met for each of the row. 

1) 'System name' column does not with AZR

2) Tags column should not have 'Citrix'

$file = "\\servername\reports.csv"


Import-Csv $file | where {($_."System Name" -notlike "AZR*") -and ($_.Tags -notlike "*Citrix*")} | Export-Csv Old.csv -notypeinfo



I tried this script, but looks like I am unable to make the 'and' operator work properly.There are some rows where only one of the condition was met, but they were skipped from the output. Both the conditions need to be meet within each row. Please advice. 

How to find PID of background-job(Start-job)

$
0
0

I'm doing something background-job(Start-job) with PowerShell.

And I have many background-jobs. However I can't find PID of each jobs but Id of jobs.

Is there any good solution for it with PowerShell?

Desired State Configuration Acceleration the execution processes

$
0
0

Hi, everyone

In first I want to thanks sociality for support and good information.
So...
I have two questions but they are very critical for my and project that I do.
I use Desired State Configuration for deployment complicated Environment, it works with Microsoft DevOps & Azure Portal
My single "script" included sections for a few Node, and in the end, I have got Virtual Machines in Azure Portal, It works, and it's great!
But Process of deployment is very very slow. It is really slow, for example it takes 8 hour, 8 hour for creation and installation software on Nodes.
I have the next Nodes:

  1. Domain Controller (on one VM )
  2. SQL Server (on second VM )
  3. Exchange Server (on third VM)
  4. One Server with my product (on fourth VM)
  5. One Server with my another product (on fifth VM)

When I read logs with execution steps, I see that some actions like Windows Feature installation/ promotion server to DC (~30 min), doesn't take a lot of time.
Also from logs I know what installation of SQL server doesn't take a lot time too (~30 minutes)
But when I look at EventViewer I See that LCM has status likes Start >> Stopped >> Start >> Stopped
So I have situation when between the steps LCM is Idled - it is FIRST QUESTION - WHY LCM is IDLE and STEPS are not execute faster

The second question is, How I can execute steps in 
Parallel for independent Nodes.
Does DSC support this mechanism???
In internet I find something like this:
https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088678-execute-indepenent-dsc-steps-in-parallel

Thanks for Help
Best regards, elArch


Zip all folder in the current directory without putting them as individual zips

$
0
0
1. This script zips all the file in which it is located.
2. This script zips all the file as individual files

I am trying to all files to one single zip without creating another folder in it, similar to selecting all contents of the directory > right click > send to compressed.
no matter how many changes i did i could not produce the desired results
what i am missing here.
can any one please explain
@echo off
cd /d %~dp0
rem 7z.exe path
set sevenzip=
if "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exe
if "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exe
if "%sevenzip%"=="" echo 7-zip not found&pause&exit
set extension=.*
for %%a in (*%extension%) do "%sevenzip%" a "%%~na.zip" "%%a"
pause
[/CODE]


Looking to get SQLServer module on Powershell 4.0

$
0
0

I am trying to get the SqlServer module on PowerShell 4.0

I don't have permission to update and install Microsoft Framework or the latest PowerShell so I need an alternative. I am trying to do this via remote desktop. I have PowerShell 5 on my local machine and with the same account/permissions can install modules with install-module and I have installed SqlServer on it. 

How can i get it on the remote server with PowerShell 4 or is there another way I can modify my SQL database with PowerShell?

Thanks in advance. 

Kerberos Constrained Delegation to SQL-Server

$
0
0

Hi,

I have configured Kerberos Constrained Delegation to access a file share on Server C when PS-Remoting to Server B. This works fine.

Now I have to access a SQL-Server database. So a configured the SQL-Server SPN to delegate to (on Server B Computer Object in AD), but it doesn't work.
Other client connections to the SQL-Server are authenticated with Kerberos, so it works basically.

Any tips for me?

thx.

Homeshare in Powershell with AD Attributes

$
0
0

Hello

I wrote a script witch adds the homeshare.

$User = $env:USERNAME
Get-ADUser $User -Properties Department, Company
$UserP = "\\Server\$($User.Company)\$($User.Department)_Userhomes\$User"
New-PSDrive -Name "P" -PSProvider FileSystem -Root "$UserP"

If i check $UserP i get:

\\Server\\_Userhomes\Administrator

and i need the AD Attributes...

Thanks for your help

Powershell command Start-MPWDoscan doesnt work in Windows 2016 Server for Offline Defender Scan

$
0
0

Is this supposed to work in Server 2016?  

I get an error that says: errors were encountered when attempted to run WDO scan on your PC.

at Line:1  Char:1
Start-wpmwdoscan

+categoryinfo:  not specified: (MSFT_MpWDOCScan:root\Microsoft\...\msft_mpwdoscan)

Any suggestions/

Loop cycle through tabcontrol tabs - Powershell

$
0
0

Hi,

First post on this forum.

Through using Sapiens Powershell studio, I have created a basic form. This form consists of a tabcontrol, with tabs. Each tab has web content on it which is not relevant at the moment.

I want to cycle through the tabs in tabscontrol, one by one in a loop, staying on each tab for (let's say) 5 seconds.

I've tried loop methods but the problem I'm facing is when it's cycling through the tabs, it doesn't display the tabs content until the loop gets to the end and finished - it in a way "freezes" the GUI, not allowing input or showing content until its finished the code. You can see it cycling through the tabs but it doesn't display the tab content.

I've tried the follow upon a button click:

$button1_Click={for ($i = 0; $i-lt$tabControl1.TabCount;$i++) { $tabcontrol1.SelectedIndex = $i Write-Host $tabcontrol1.SelectedTab.Name UpdateNavButtons Start-Sleep -Seconds 5 } Write-Host finished }

But this finishes at the last tab and again, doesn't display tab content while cycling.

Ultimate question is - how can I cycle through the tabs in tabcontrol on a PowerShell GUI?

Sorry if i havent explained properly. Let me know if anything else is needed.

Thanks

Viewing all 21975 articles
Browse latest View live


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