I am attempting to write a version of Cards Against IT and have a question.
I have an array from which I am using Get-Random. My first thought was to have the white and czar cards both on one script. but I would need to use items= list of cards then use the for-each item in items function. If I had both types of cards in a list I would assume the script would not work with 2 "list" cmdlets. Can I rename these to "cards" and "czar"
this an example of the white cards in a array I believe.
also when I run this script instead of only one item in the list getting returned all of them do. How could I fix this? Any direction is always appreciated.
#Generated Form Function
function GenerateForm {
########################################################################
# Generated On: 8/29/2016 1:53 PM
# Generated By: christnerw
########################################################################
#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out- Null
#endregion
#region Generated Form Objects
$form1 = New-Object System.Windows.Forms.Form
$richTextBox9 = New-Object System.Windows.Forms.RichTextBox
$card = New-Object System.Windows.Forms.Button
$richTextBox8 = New-Object System.Windows.Forms.RichTextBox
$richTextBox7 = New-Object System.Windows.Forms.RichTextBox
$richTextBox6 = New-Object System.Windows.Forms.RichTextBox
$richTextBox5 = New-Object System.Windows.Forms.RichTextBox
$richTextBox4 = New-Object System.Windows.Forms.RichTextBox
$richTextBox3 = New-Object System.Windows.Forms.RichTextBox
$Czar = New-Object System.Windows.Forms.Button
$richTextBox2 = New-Object System.Windows.Forms.RichTextBox
$richTextBox1 = New-Object System.Windows.Forms.RichTextBox
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects
#----------------------------------------------
#Generated Event Script Blocks
#----------------------------------------------
#Provide Custom Code for events specified in PrimalForms.
$handler_richTextBox7_TextChanged=
{
#TODO: Place custom script here
}
$handler_form1_Load=
{
#TODO: Place custom script here
}
$card_OnClick= {
$richTextBox2.Text = $white
}
$card_OnClick= {
$richTextBox3.Text = $white
}
$card_OnClick= {
$richTextBox4.Text = $white
}
$card_OnClick= {
$richTextBox5.Text = $white
}
$card_OnClick= {
$richTextBox6.Text = $white
}
$card_OnClick= {
$richTextBox7.Text = $white
}
$card_OnClick= {
$richTextBox8.Text = $white
}
$card_OnClick= {
$richTextBox9.Text = $white |Out-String
}
{
}
$handler_richTextBox5_TextChanged=
{
#TODO: Place custom script here
}
$handler_Czar_Click= {
$richTextBox1.Text = $czar |Out-String
}
{
}
$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
#----------------------------------------------
#region Generated Form Code
$form1.BackColor = [System.Drawing.Color]::FromArgb(255,139,0,0)
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 808
$System_Drawing_Size.Width = 1306
$form1.ClientSize = $System_Drawing_Size
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$form1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,1,3,1)
$form1.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon('C:\Users\christnerw\Desktop\Powers hell Project\flat_icons-graficheria.ico')
$form1.Name = "form1"
$form1.Text = "Cards Aghinst IT"
$form1.add_Load($handler_form1_Load)
$richTextBox9.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$richTextBox9.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox9.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox9.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 992
$System_Drawing_Point.Y = 532
$richTextBox9.Location = $System_Drawing_Point
$richTextBox9.Name = "richTextBox9"
$richTextBox9.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 283
$richTextBox9.Size = $System_Drawing_Size
$richTextBox9.TabIndex = 12
$richTextBox9.Text = ""
$form1.Controls.Add($richTextBox9)
$card.DataBindings.DefaultDataSourceUpdateMode = 0
$card.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 1062
$System_Drawing_Point.Y = 198
$card.Location = $System_Drawing_Point
$card.Name = "card"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 51
$System_Drawing_Size.Width = 189
$card.Size = $System_Drawing_Size
$card.TabIndex = 10
$card.Text = "Click for White Card"
$card.UseVisualStyleBackColor = $True
$card.add_Click($card_OnClick)
$form1.Controls.Add($card)
$richTextBox8.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$richTextBox8.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox8.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox8.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 686
$System_Drawing_Point.Y = 532
$richTextBox8.Location = $System_Drawing_Point
$richTextBox8.Name = "richTextBox8"
$richTextBox8.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 283
$richTextBox8.Size = $System_Drawing_Size
$richTextBox8.TabIndex = 8
$richTextBox8.Text = ""
$form1.Controls.Add($richTextBox8)
$richTextBox7.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$richTextBox7.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox7.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox7.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 365
$System_Drawing_Point.Y = 532
$richTextBox7.Location = $System_Drawing_Point
$richTextBox7.Name = "richTextBox7"
$richTextBox7.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 297
$richTextBox7.Size = $System_Drawing_Size
$richTextBox7.TabIndex = 7
$richTextBox7.Text = ""
$richTextBox7.add_TextChanged($handler_richTextBox7_TextChanged)
$form1.Controls.Add($richTextBox7)
$richTextBox6.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$richTextBox6.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox6.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox6.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 60
$System_Drawing_Point.Y = 532
$richTextBox6.Location = $System_Drawing_Point
$richTextBox6.Name = "richTextBox6"
$richTextBox6.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 283
$richTextBox6.Size = $System_Drawing_Size
$richTextBox6.TabIndex = 6
$richTextBox6.Text = ""
$form1.Controls.Add($richTextBox6)
$richTextBox5.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$richTextBox5.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox5.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox5.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 60
$System_Drawing_Point.Y = 274
$richTextBox5.Location = $System_Drawing_Point
$richTextBox5.Name = "richTextBox5"
$richTextBox5.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 283
$richTextBox5.Size = $System_Drawing_Size
$richTextBox5.TabIndex = 5
$richTextBox5.Text = ""
$richTextBox5.add_TextChanged($handler_richTextBox5_TextChanged)
$form1.Controls.Add($richTextBox5)
$richTextBox4.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$richTextBox4.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox4.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox4.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 992
$System_Drawing_Point.Y = 274
$richTextBox4.Location = $System_Drawing_Point
$richTextBox4.Name = "richTextBox4"
$richTextBox4.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 283
$richTextBox4.Size = $System_Drawing_Size
$richTextBox4.TabIndex = 4
$richTextBox4.Text = ""
$form1.Controls.Add($richTextBox4)
$richTextBox3.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox3.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox3.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 686
$System_Drawing_Point.Y = 274
$richTextBox3.Location = $System_Drawing_Point
$richTextBox3.Name = "richTextBox3"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 283
$richTextBox3.Size = $System_Drawing_Size
$richTextBox3.TabIndex = 3
$richTextBox3.Text = ""
$form1.Controls.Add($richTextBox3)
$Czar.DataBindings.DefaultDataSourceUpdateMode = 0
$Czar.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 199
$System_Drawing_Point.Y = 28
$Czar.Location = $System_Drawing_Point
$Czar.Name = "Czar"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 135
$Czar.Size = $System_Drawing_Size
$Czar.TabIndex = 2
$Czar.Text = "Click for Czar Card"
$Czar.UseVisualStyleBackColor = $True
$Czar.add_Click($handler_Czar_Click)
$form1.Controls.Add($Czar)
$richTextBox2.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$richTextBox2.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox2.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 365
$System_Drawing_Point.Y = 274
$richTextBox2.Location = $System_Drawing_Point
$richTextBox2.Name = "richTextBox2"
$richTextBox2.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 297
$richTextBox2.Size = $System_Drawing_Size
$richTextBox2.TabIndex = 1
$richTextBox2.Text = ""
$form1.Controls.Add($richTextBox2)
$richTextBox1.BackColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$richTextBox1.Cursor = [System.Windows.Forms.Cursors]::Hand
$richTextBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$richTextBox1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
$richTextBox1.ForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 391
$System_Drawing_Point.Y = 28
$richTextBox1.Location = $System_Drawing_Point
$richTextBox1.Name = "richTextBox1"
$richTextBox1.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 221
$System_Drawing_Size.Width = 490
$richTextBox1.Size = $System_Drawing_Size
$richTextBox1.TabIndex = 0
$richTextBox1.Text = ""
$form1.Controls.Add($richTextBox1)
#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($OnLoadForm_StateCorrection)
#Show the Form
$form1.ShowDialog()| Out-Null
} #End Function
#Call the Function
GenerateForm
# Cards
########################################################################################
$white =
"Rotating the Backup Tapes" ,
"a PEBCAK" ,
"rm -rf /*.*" ,
"a faulty crossover cable" ,
"a KVM with a broken M" ,
"a one button mouse" ,
"a laser pointer" ,
"scanning a little too much with nmap" ,
"a coffee stained mousepad" ,
"a webcam pointed at the coffee maker" ,
"a bastion host" ,
"a salvaged motherboard with a parallel port" ,
"a razorsharp punchdown tool" ,
"my rooted phone" ,
"a mouse connected serial -> ps/2 -> usb" ,
"0118 999 881 999 119 725...3" ,
"my password" ,
"a fingerprint scanner" ,
"a scanning electron microscope" ,
"a helpdesk ticket to 'fix the cpu'" ,
"a hard drive degaussing machine" ,
"a multitool with a bottle opener" ,
"a larger database connection pool" ,
"a rainbow pack of 3.5 floppy disks" ,
"a usb stick found in the parking lot" ,
"an Arduino runnning NetBSD" ,
"a shell script written in BASIC" ,
"Edward Snowden" ,
"CryptoLocker" ,
"a serial port mouse" ,
"5000 free AOL CDs" ,
"Angelina Jolie in Hackers" ,
"an RJ-45 crimping tool" ,
"Clippy" ,
"Two Factor Auth" ,
"Have you tried turning it off and on again" ,
"a flaky VPN connection" ,
"script kiddies" ,
"an IP Webcam with a default password" ,
"rebuilding a RAID array" ,
"manually fixing 10/100/1000 'auto' negotiation" ,
"viewing web filter block logs" ,
"the server is down" ,
"pinging 127.0.0.1" ,
"Using hillary clinton's private email server"
##################################################################################################
$czar =
"The new IT Director has a sick tattoo of ____________",
"The last consultant was fired over ____________",
"In a pinch, ____________ can be used to remote reboot a server",
"____________ is Layer 8 of the OSI networking model",
"Forgetting ____________ in the datacenter is a firing offense",
"We're going to use ____________ instead of updating to IPv6",
"____________ is the last stage of our ____________ rollout (Pick 2)",
"That red plunger switch on the wall launches ____________",
"I got this coffee mug from a conference about ____________ back in 1997",
"Had a user fall prey to a sophisticated ____________ phishing attack",
"Two factor auth with ____________ and ____________ (Pick 2)",
"Forgot my badge this morning and had to use ____________ to get in",
"____________ is now included for free with every OS Update",
"____________ is now required every time you restart ____________ (Pick 2)",
"The hot new videogame this year is ____________ Simulator!",
"A helpdesk call to fix ____________ with ____________ (Pick 2)",
"I just got a new certification in ____________"
