Advertisement
Guest User

Untitled

a guest
Mar 9th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.41 KB | None | 0 0
  1. ########################################################################################################################################################
  2. # Powershell GUI Tool for basic windows Administration###############
  3. # Created by MLLSatyanarayana Email=mllsatyanarayana@gmail.com
  4. # Version:1.3
  5. # Enter one or mutiple servers line by line under EnterServers box and click the buttons according to your requirement
  6. #
  7. # In this tool all are self explantory except belwo ones
  8. # 1) Servic check
  9. # 2) Check Process
  10. # 3)Port check #
  11. # 4) Search Event logs
  12. #
  13. # For checking Services
  14. # example in order to check the specfic service name just enter first 3 letter of service name in the Filter box and click in service check
  15. # you will get the all the services list whih running with that words you mentioned
  16. # note: if you do not specify any words it will display all the services
  17. # For checking process
  18. # example in order to check the specfic process name just enter first 3 letter of processname in the Filter box and click in process check
  19. # you will get the all the services list whih running with that words you mentioned
  20. # note: if you do not specify any words it will display all the process
  21. #
  22. # For checking event logs
  23. # example: if you want to check the event logs system or applications select the log types and enter key words or Event ID in the filter box
  24. #
  25. # # Note: Please copy "Lucida Sans Typewriter,9" font in your server where this tool is running in order to get the out put in clearly
  26. #
  27. #
  28. # @@@@@@@@@@@@@@@@@@@@@You can covert this script to exe @@@@@@@@@@@@@@@@@@@@
  29. ########################################################################################################################################################
  30.  
  31.  
  32.  
  33.  
  34. Add-Type -AssemblyName System.Windows.Forms
  35.  
  36. $Form = New-Object system.Windows.Forms.Form
  37. $Form.Text = "Power-GUI Version 1.3 Created by mllsatyanarayana@gmail.com"
  38. $Form.TopMost = $true
  39. $Form.Width = 900
  40. $Form.Height = 700
  41. $Form.FormBorderStyle= "Fixed3D"
  42. $form.StartPosition ="centerScreen"
  43. $form.ShowInTaskbar = $true
  44.  
  45.  
  46.  
  47. $StatusBar = New-Object System.Windows.Forms.StatusBar
  48. $StatusBar.Text = "Ready"
  49. $StatusBar.Height = 22
  50. $StatusBar.Width = 200
  51. $StatusBar.Location = New-Object System.Drawing.Point( 0, 250 )
  52. $Form.Controls.Add($StatusBar)
  53.  
  54.  
  55.  
  56. $InputBox = New-Object system.windows.Forms.TextBox
  57. $InputBox.Multiline = $true
  58. $InputBox.BackColor = "#A7D4F7"
  59. $InputBox.Width = 280
  60. $InputBox.Height = 132
  61. $InputBox.ScrollBars ="Vertical"
  62. $InputBox.location = new-object system.drawing.point(3,31)
  63. $InputBox.Font = "Microsoft Sans Serif,10,style=Bold"
  64. $Form.controls.Add($inputbox)
  65.  
  66.  
  67.  
  68. $outputBox= New-Object System.Windows.Forms.RichTextBox
  69. $outputBox.Multiline = $true
  70. $outputBox.BackColor = "#FDFEFE"
  71. $outputBox.Width = 1200
  72. $outputBox.Height = 300
  73. $outputBox.ReadOnly =$true
  74. $outputBox.ScrollBars = "Both"
  75. $outputBox.WordWrap = $false
  76. $outputBox.location = new-object system.drawing.point(9,420)
  77. $outputBox.Font = "Lucida Sans Typewriter,9"
  78. $Form.controls.Add($outputBox)
  79.  
  80.  
  81. $label3 = New-Object system.windows.Forms.Label
  82. $label3.Text = "EnterServers"
  83. $label3.AutoSize = $true
  84. $label3.Width = 25
  85. $label3.Height = 10
  86. $label3.location = new-object system.drawing.point(4,9)
  87. $label3.Font = "Microsoft Sans Serif,10,style=Bold"
  88. $Form.controls.Add($label3)
  89.  
  90.  
  91. $filterbox= New-Object system.windows.Forms.TextBox
  92. $filterbox.Multiline = $true
  93. $filterbox.Width = 280
  94. $filterbox.Height = 77
  95. $filterbox.ScrollBars ="Vertical"
  96. $filterbox.location = new-object system.drawing.point(6,191)
  97. $filterbox.Font = "Microsoft Sans Serif,10"
  98. $Form.controls.Add($filterbox)
  99.  
  100. $Filters = New-Object system.windows.Forms.Label
  101. $Filters.Text = "Filters"
  102. $Filters.AutoSize = $true
  103. $Filters.Width = 25
  104. $Filters.Height = 10
  105. $Filters.location = new-object system.drawing.point(7,170)
  106. $Filters.Font = "Microsoft Sans Serif,10,style=Bold"
  107. $Form.controls.Add($Filters)
  108.  
  109. $Eventlb = New-Object system.windows.Forms.Label
  110. $Eventlb.Text = "Search Eventlogs"
  111. $Eventlb.AutoSize = $true
  112. $Eventlb.Width = 25
  113. $Eventlb.Height = 10
  114. $Eventlb.location = new-object system.drawing.point(7,280)
  115. $Eventlb.Font = "Microsoft Sans Serif,10,style=Bold"
  116. $Form.controls.Add($Eventlb)
  117.  
  118. $applicationbutton = New-Object system.windows.Forms.Button
  119. $applicationbutton.BackColor = "#F2FD48"
  120. $applicationbutton.Text = "Application Logs"
  121. $applicationbutton.Width = 100
  122. $applicationbutton.Height = 25
  123. $applicationbutton.location = new-object system.drawing.point(170,300)
  124. $applicationbutton.Font = "Microsoft Sans Serif,8"
  125. $applicationbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(36, 36,255 )
  126. $applicationbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  127. $applicationbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  128. $applicationbutton.Add_Click({SAeventlogs})
  129. $Form.controls.Add($applicationbutton)
  130.  
  131.  
  132.  
  133. $sysbutton= New-Object system.windows.Forms.Button
  134. $sysbutton.BackColor = "#56ACF7"
  135. $sysbutton.Text = "System Logs"
  136. $sysbutton.Width = 100
  137. $sysbutton.Height = 25
  138. $sysbutton.location = new-object system.drawing.point(270,300)
  139. $sysbutton.Font = "Microsoft Sans Serif,8"
  140. $sysbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(36, 255, 36)
  141. $sysbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  142. $sysbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  143. $sysbutton.Add_Click({SAeventlogs})
  144. $Form.controls.Add($sysbutton)
  145.  
  146. $Setup= New-Object system.windows.Forms.Button
  147. $Setup.BackColor = "#FF5733"
  148. $Setup.Text = "Setup Logs"
  149. $Setup.Width = 100
  150. $Setup.Height = 25
  151. $Setup.location = new-object system.drawing.point(370,300)
  152. $Setup.Font = "Microsoft Sans Serif,8"
  153. $Setup.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  154. $Setup.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  155. $Setup.Cursor = [System.Windows.Forms.Cursors]::Hand
  156. $Setup.Add_Click({SAeventlogs})
  157. $Form.controls.Add($Setup)
  158.  
  159.  
  160.  
  161.  
  162.  
  163. #Dropdown Box
  164. $Dropdown = New-Object system.windows.Forms.ComboBox
  165. $Dropdown.BackColor = "#e4f3fa"
  166. $Dropdown.Width = 150
  167. $Dropdown.Height = 20
  168. $Dropdown.location = new-object system.drawing.point(9,300)
  169. $Dropdown.Font = "Microsoft Sans Serif,10"
  170.  
  171. $Form.controls.Add($Dropdown)
  172.  
  173. $EVList=@("Application","System","Setup")
  174.  
  175. foreach ($EV in $EVList) {
  176. $DropDown.Items.Add($EV)
  177. }
  178.  
  179.  
  180. ##Dropdown Box End
  181.  
  182.  
  183.  
  184.  
  185.  
  186. $Outputlb = New-Object system.windows.Forms.Label
  187. $Outputlb.Text = "Output"
  188. $Outputlb.AutoSize = $true
  189. $Outputlb.Width = 25
  190. $Outputlb.Height = 10
  191. $Outputlb.location = new-object system.drawing.point(12,370)
  192. $Outputlb.Font = "Microsoft Sans Serif,20,style=Bold"
  193. $Form.controls.Add($Outputlb)
  194.  
  195.  
  196.  
  197.  
  198.  
  199. $Upbutton = New-Object system.windows.Forms.Button
  200. $Upbutton.BackColor = "#5bd22c"
  201. $Upbutton.Text = "Uptime"
  202. $Upbutton.Width = 80
  203. $Upbutton.Height = 22
  204. $Upbutton.location = new-object system.drawing.point(309,170)
  205. $Upbutton.Font = "Microsoft Sans Serif,8"
  206. $Upbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  207. $Upbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  208. $Upbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  209. $Upbutton.Add_Click({uptime})
  210. $Form.controls.Add($Upbutton)
  211.  
  212. $NICbutton = New-Object system.windows.Forms.Button
  213. $NICbutton.BackColor = "#5bd22c"
  214. $NICbutton.Text = "Nicdetails"
  215. $NICbutton.Width = 80
  216. $NICbutton.Height = 22
  217. $NICbutton.location = new-object system.drawing.point(309,200)
  218. $NICbutton.Font = "Microsoft Sans Serif,8"
  219. $NICbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  220. $NICbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  221. $NICbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  222. $NICbutton.Add_Click({nic})
  223. $Form.controls.Add($NICbutton)
  224.  
  225.  
  226. $WLAbutton = New-Object system.windows.Forms.Button
  227. $WLAbutton.BackColor = "#5bd22c"
  228. $WLAbutton.Text = "Windows OS Activation status"
  229. $WLAbutton.Width = 180
  230. $WLAbutton.Height = 22
  231. $WLAbutton.location = new-object system.drawing.point(309,230)
  232. $WLAbutton.Font = "Microsoft Sans Serif,8"
  233. $WLAbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  234. $WLAbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  235. $WLAbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  236. $WLAbutton.Add_Click({WLA})
  237. $Form.controls.Add($WLAbutton)
  238.  
  239.  
  240.  
  241. $Serbutton = New-Object system.windows.Forms.Button
  242. $Serbutton.BackColor = "#5bd22c"
  243. $Serbutton.Text = "Servicecheck"
  244. $Serbutton.Width = 80
  245. $Serbutton.Height = 22
  246. $Serbutton.location = new-object system.drawing.point(309,50)
  247. $Serbutton.Font = "Microsoft Sans Serif,8"
  248. $Serbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  249. $Serbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  250. $Serbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  251. $Serbutton.Add_Click({Service})
  252. $Form.controls.Add($Serbutton)
  253.  
  254. $Biosbutton = New-Object system.windows.Forms.Button
  255. $Biosbutton.BackColor = "#5bd22c"
  256. $Biosbutton.Text = "Bios Details"
  257. $Biosbutton.Width = 80
  258. $Biosbutton.Height = 22
  259. $Biosbutton.location = new-object system.drawing.point(309,80)
  260. $Biosbutton.Font = "Microsoft Sans Serif,8"
  261. $Biosbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  262. $Biosbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  263. $Biosbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  264. $Biosbutton.Add_Click({bios})
  265. $Form.controls.Add($Biosbutton)
  266.  
  267. $Listservicebutton = New-Object system.windows.Forms.Button
  268. $Listservicebutton.BackColor = "#5bd22c"
  269. $Listservicebutton.Text = "List Services"
  270. $Listservicebutton.Width = 80
  271. $Listservicebutton.Height = 22
  272. $Listservicebutton.location = new-object system.drawing.point(309,110)
  273. $Listservicebutton.Font = "Microsoft Sans Serif,8"
  274. $Listservicebutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  275. $Listservicebutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  276. $Listservicebutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  277. $Listservicebutton.Add_Click({get-ser})
  278. $Form.controls.Add($Listservicebutton)
  279.  
  280.  
  281. $InstalledAppsbutton = New-Object system.windows.Forms.Button
  282. $InstalledAppsbutton.BackColor = "#5bd22c"
  283. $InstalledAppsbutton.Text = "InstalledApps"
  284. $InstalledAppsbutton.Width = 80
  285. $InstalledAppsbutton.Height = 22
  286. $InstalledAppsbutton.location = new-object system.drawing.point(309,140)
  287. $InstalledAppsbutton.Font = "Microsoft Sans Serif,8"
  288. $InstalledAppsbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  289. $InstalledAppsbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  290. $InstalledAppsbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  291. $InstalledAppsbutton.Add_Click({applist})
  292. $Form.controls.Add($InstalledAppsbutton)
  293.  
  294. $Pingbutton = New-Object system.windows.Forms.Button
  295. $Pingbutton.BackColor = "#5bd22c"
  296. $Pingbutton.Text = "Ping"
  297. $Pingbutton.Width = 80
  298. $Pingbutton.Height = 22
  299. $Pingbutton.location = new-object system.drawing.point(309,21)
  300. $Pingbutton.Font = "Microsoft Sans Serif,8"
  301. $Pingbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  302. $Pingbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  303. $Pingbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  304. $Pingbutton.Add_Click({pingInfo})
  305. $Form.controls.Add($Pingbutton)
  306.  
  307. $diskbutton = New-Object system.windows.Forms.Button
  308. $diskbutton.BackColor = "#5bd22c"
  309. $diskbutton.Text = "Drive Useage"
  310. $diskbutton.Width = 80
  311. $diskbutton.Height = 22
  312. $diskbutton.location = new-object system.drawing.point(400,21)
  313. $diskbutton.Font = "Microsoft Sans Serif,8"
  314. $diskbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  315. $diskbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  316. $diskbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  317. $diskbutton.Add_Click({disk})
  318. $Form.controls.Add($diskbutton)
  319.  
  320.  
  321. $cpubutton = New-Object system.windows.Forms.Button
  322. $cpubutton.BackColor = "#5bd22c"
  323. $cpubutton.Text = "Cpu Utlization"
  324. $cpubutton.Width = 80
  325. $cpubutton.Height = 22
  326. $cpubutton.location = new-object system.drawing.point(400,50)
  327. $cpubutton.Font = "Microsoft Sans Serif,8"
  328. $cpubutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  329. $cpubutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  330. $cpubutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  331. $cpubutton.Add_Click({cpu})
  332. $Form.controls.Add($cpubutton)
  333.  
  334. $HWSbutton = New-Object system.windows.Forms.Button
  335. $HWSbutton.BackColor = "#5bd22c"
  336. $HWSbutton.Text = "Get-HWSerial"
  337. $HWSbutton.Width = 80
  338. $HWSbutton.Height = 22
  339. $HWSbutton.location = new-object system.drawing.point(400,140)
  340. $HWSbutton.Font = "Microsoft Sans Serif,9"
  341. $HWSbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  342. $HWSbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  343. $HWSbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  344. $HWSbutton.Add_Click({Get-hwserial})
  345. $Form.controls.Add($HWSbutton)
  346.  
  347. $Membutton = New-Object system.windows.Forms.Button
  348. $Membutton.BackColor = "#5bd22c"
  349. $Membutton.Text = "Memmoryuse"
  350. $Membutton.Width = 80
  351. $Membutton.Height = 22
  352. $Membutton.location = new-object system.drawing.point(400,80)
  353. $Membutton.Font = "Microsoft Sans Serif,8"
  354. $Membutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  355. $Membutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  356. $Membutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  357. $Membutton.Add_Click({Memmoryuse})
  358. $Form.controls.Add($Membutton)
  359.  
  360. $OSVbutton = New-Object system.windows.Forms.Button
  361. $OSVbutton.BackColor = "#5bd22c"
  362. $OSVbutton.Text = "OsVersion"
  363. $OSVbutton.Width = 80
  364. $OSVbutton.Height = 22
  365. $OSVbutton.location = new-object system.drawing.point(490,140)
  366. $OSVbutton.Font = "Microsoft Sans Serif,8"
  367. $OSVbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  368. $OSVbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  369. $OSVbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  370. $OSVbutton.Add_Click({get-osv})
  371. $Form.controls.Add($OSVbutton)
  372.  
  373.  
  374. $Process = New-Object system.windows.Forms.Button
  375. $Process.BackColor = "#5bd22c"
  376. $Process.Text = "Check Process"
  377. $Process.Width = 80
  378. $Process.Height = 22
  379. $Process.location = new-object system.drawing.point(400,110)
  380. $Process.Font = "Microsoft Sans Serif,8"
  381. $Process.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  382. $Process.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  383. $Process.Cursor = [System.Windows.Forms.Cursors]::Hand
  384. $Process.Add_Click({proc})
  385. $Form.controls.Add($Process)
  386.  
  387. $commgmtbutton = New-Object system.windows.Forms.Button
  388. $commgmtbutton.BackColor = "#55e72c"
  389. $commgmtbutton.Text = "Compmgmt"
  390. $commgmtbutton.Width = 80
  391. $commgmtbutton.Height = 22
  392. $commgmtbutton.location = new-object system.drawing.point(400,170)
  393. $commgmtbutton.Font = "Microsoft Sans Serif,8"
  394. $commgmtbutton.Add_Click({sysmgmt})
  395. $commgmtbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  396. $commgmtbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  397. $commgmtbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  398. $Form.controls.Add($commgmtbutton)
  399.  
  400.  
  401.  
  402. $LAdminbutton = New-Object system.windows.Forms.Button
  403. $LAdminbutton.BackColor = "#5bd22c"
  404. $LAdminbutton.Text = "Get-localadmins"
  405. $LAdminbutton.Width = 89
  406. $LAdminbutton.Height = 22
  407. $LAdminbutton.location = new-object system.drawing.point(490,21)
  408. $LAdminbutton.Font = "Microsoft Sans Serif,8"
  409. $LAdminbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  410. $LAdminbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  411. $LAdminbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  412. $LAdminbutton.Add_Click({Localadmins})
  413. $Form.controls.Add($LAdminbutton)
  414.  
  415. $DSAbutton = New-Object system.windows.Forms.Button
  416. $DSAbutton.BackColor = "#5bd22c"
  417. $DSAbutton.Text = "DSA.MSC"
  418. $DSAbutton.Width = 80
  419. $DSAbutton.Height = 22
  420. $DSAbutton.location = new-object system.drawing.point(490,50)
  421. $DSAbutton.Font = "Microsoft Sans Serif,8"
  422. $DSAbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  423. $DSAbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  424. $DSAbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  425. $DSAbutton.Add_Click({dsamsc})
  426. $Form.controls.Add($DSAbutton)
  427.  
  428. $portbutton = New-Object system.windows.Forms.Button
  429. $portbutton.BackColor = "#5bd22c"
  430. $portbutton.Text = "Port check"
  431. $portbutton.Width = 80
  432. $portbutton.Height = 22
  433. $portbutton.location = new-object system.drawing.point(490,80)
  434. $portbutton.Font = "Microsoft Sans Serif,8"
  435. $portbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  436. $portbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  437. $portbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  438. $portbutton.Add_Click({Get-portstatus})
  439. $Form.controls.Add($portbutton)
  440.  
  441.  
  442. $Remoteshutbutton = New-Object system.windows.Forms.Button
  443. $Remoteshutbutton.BackColor = "#e3211d"
  444. $Remoteshutbutton.Text = "RemoteShutdown"
  445. $Remoteshutbutton.Width = 88
  446. $Remoteshutbutton.Height = 22
  447. $Remoteshutbutton.location = new-object system.drawing.point(490,110)
  448. $Remoteshutbutton.Font = "Microsoft Sans Serif,7"
  449. $Remoteshutbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  450. $Remoteshutbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  451. $Remoteshutbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  452. $Remoteshutbutton.Add_Click({poweroff})
  453. $Form.controls.Add($Remoteshutbutton)
  454.  
  455.  
  456.  
  457. $Hotfixbutton= New-Object system.windows.Forms.Button
  458. $Hotfixbutton.BackColor = "#5bd22c"
  459. $Hotfixbutton.Text = "Hotfix"
  460. $Hotfixbutton.Width = 80
  461. $Hotfixbutton.Height = 22
  462. $Hotfixbutton.location = new-object system.drawing.point(490,170)
  463. $Hotfixbutton.Font = "Microsoft Sans Serif,8"
  464. $Hotfixbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  465. $Hotfixbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  466. $Hotfixbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  467. $Hotfixbutton.Add_Click({Get-update})
  468. $Form.controls.Add($Hotfixbutton)
  469.  
  470.  
  471. $exitbutton = New-Object system.windows.Forms.Button
  472. $exitbutton.BackColor = "#5bd22c"
  473. $exitbutton.Text = "Exit"
  474. $exitbutton.Width = 80
  475. $exitbutton.Height = 22
  476. $exitbutton.location = new-object system.drawing.point(600,20)
  477. $exitbutton.Font = "Microsoft Sans Serif,8"
  478. $exitbutton.FlatAppearance.MouseOverBackColor = [System.Drawing.Color]::FromArgb(255, 255, 36)
  479. $exitbutton.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
  480. $exitbutton.Cursor = [System.Windows.Forms.Cursors]::Hand
  481. $exitbutton.Add_Click({$form.close()})
  482. $Form.controls.Add($exitbutton)
  483.  
  484.  
  485.  
  486.  
  487. ###################This function is to dispaly the progress############################
  488. Function Progressbar
  489. {
  490. Add-Type -AssemblyName system.windows.forms
  491. $Script:formt = New-Object System.Windows.Forms.Form
  492. $Script:formt.Text = 'Please Wait'
  493. $Script:formt.TopMost = $true
  494. $Script:formt.StartPosition ="CenterScreen"
  495. $Script:formt.Width = 500
  496. $Script:formt.Height = 20
  497. $Script:formt.MaximizeBox = $false
  498. $Script:formt.MinimizeBox = $false
  499. $Script:formt.Visible = $false
  500.  
  501.  
  502. }
  503.  
  504. ############################################## End of Progressbar function#############
  505.  
  506.  
  507.  
  508. ############################################## PingFunction#############
  509.  
  510. function pingInfo {
  511.  
  512. $statusBar.Text=("Processing the request")
  513. progressbar
  514. $outputBox.Clear()
  515. $computers=$InputBox.lines.Split("`n")
  516. $date =Get-Date
  517. $ct = "Task Completed @ " + $date
  518. $Script:formt.Visible=$true
  519. $infping =@()
  520. foreach ($computer in $computers)
  521. {
  522.  
  523. $Script:formt.text="Working on $computer"
  524. $infping +=ping $computer -n 3
  525. $pingResult=$infping| ft | out-string
  526. }
  527. $outputBox.Appendtext("{0}`n" -f $pingResult + "`n $ct")
  528. $statusBar.Text=("Ready")
  529. $Script:formt.close()
  530. }
  531.  
  532. ####################end pingInfo########################################
  533.  
  534.  
  535.  
  536. ####################################Uptime function start####################################
  537.  
  538. function get-uptime {
  539. param(
  540. $computername =$env:computername
  541. )
  542.  
  543. $os = Get-WmiObject win32_operatingsystem -ComputerName $computername -ea silentlycontinue
  544. if($os){
  545. $lastbootuptime =$os.ConvertTodateTime($os.LastBootUpTime)
  546.  
  547. $LocalDateTime =$os.ConvertTodateTime($os.LocalDateTime)
  548.  
  549. $up =$LocalDateTime - $lastbootuptime
  550.  
  551. $uptime ="$($up.Days) days, $($up.Hours)h, $($up.Minutes)mins"
  552.  
  553. $results =new-object psobject
  554.  
  555. $results |Add-Member noteproperty LastBootUptime $LastBootuptime
  556. $results |Add-Member noteproperty ComputerName $computername
  557. $results |Add-Member noteproperty uptime $uptime
  558.  
  559.  
  560. #Display the results
  561.  
  562. $results | Select-Object computername,LastBootuptime,Uptime
  563.  
  564. }
  565.  
  566.  
  567. else
  568.  
  569. {
  570.  
  571. $results =New-Object psobject
  572.  
  573. $results =new-object psobject
  574. $results |Add-Member noteproperty LastBootUptime "Na"
  575. $results |Add-Member noteproperty ComputerName $computername
  576. $results |Add-Member noteproperty uptime "Na"
  577.  
  578. #display the results
  579.  
  580. $results | Select-Object computername,LastBootUptime,Uptime
  581.  
  582.  
  583.  
  584.  
  585. }
  586.  
  587.  
  588.  
  589. }
  590.  
  591. $infouptime =@()
  592.  
  593.  
  594. foreach($allserver in $allservers){
  595.  
  596. $infouptime += get-uptime $allserver
  597. }
  598.  
  599. $infouptime
  600.  
  601.  
  602.  
  603. function uptime {
  604. progressbar
  605. $outputBox.Clear()
  606. $statusBar.Text=("Processing the request")
  607. $computers=$InputBox.lines.Split("`n")
  608. $date = Get-Date
  609. $ct = "Task Completed @ " + $date
  610. $Script:formt.Visible=$true
  611. $infouptime = @()
  612. foreach ($computer in $computers)
  613. {
  614. $Script:formt.text="Working on $computer"
  615. $infouptime += get-uptime $computer
  616.  
  617. $res =$infouptime | ft -AutoSize | Out-String
  618. }
  619. $outputBox.Appendtext("{0}`n" -f $res +"`n $ct" )
  620. $statusBar.Text=("Ready")
  621. $Script:formt.close()
  622. }
  623.  
  624.  
  625.  
  626.  
  627. ####################################Uptime function end####################################
  628.  
  629.  
  630.  
  631.  
  632. #####################################Disk Functions start############################################
  633. Function Dinfo ($ComputerName=$ENV:ComputerName) {
  634.  
  635. foreach ($disk in $ComputerName){
  636. Get-WmiObject win32_logicaldisk -ComputerName $ComputerName -Filter "Drivetype=3" |
  637. Select-Object @{Label = "ServerName";Expression = {$_.__Server}},
  638. @{Label = "Drive Letter";Expression = {$_.DeviceID}},
  639. @{Label = "Total Capacity (GB)";Expression = {"{0:N1}" -f( $_.Size / 1gb)}},
  640. @{Label = "Free Space (GB)";Expression = {"{0:N1}" -f( $_.Freespace / 1gb ) }},
  641. @{Label="FreeSpace%"; Expression={"{0:N0}" -F (($_.Freespace/$_.Size)*100)}}
  642. }
  643. }
  644.  
  645.  
  646. function disk {
  647. progressbar
  648. $outputBox.Clear()
  649. $statusBar.Text=("Processing the request")
  650. $computers=$InputBox.lines.Split("`n")
  651. $date =Get-Date
  652. $ct = "Task Completed @ " + $date
  653. $Script:formt.Visible=$true
  654. $infod=@()
  655. foreach ($computer in $computers)
  656. {
  657. $Script:formt.text="Working on $computer"
  658. $infod += Dinfo $computer
  659. $dpres= $infod | ft -AutoSize | Out-String
  660. }
  661. $outputBox.Appendtext("{0}`n" -f $dpres +"`n $ct" )
  662.  
  663. $statusBar.Text=("Ready")
  664. $Script:formt.close()
  665.  
  666. }
  667.  
  668.  
  669.  
  670. #####################################Disk Functions start############################################
  671.  
  672.  
  673.  
  674. ###############################Remote shutdown#####################################
  675. function poweroff{
  676.  
  677. $po=shutdown -i
  678. Write-Host $po
  679. }
  680.  
  681.  
  682. function sysmgmt{
  683. $outputBox.Text ="opening mmc console for computer management Please wait"
  684. $cm= compmgmt.msc
  685. Write-Host $cm
  686. }
  687.  
  688.  
  689. function dsamsc{
  690. $outputBox.Text ="opening DSA.MSC console for computer management Please wait"
  691. $cm= DSA.msc
  692. Write-Host $cm
  693. }
  694.  
  695. ###############################Remote shutdown END #####################################
  696.  
  697.  
  698.  
  699.  
  700.  
  701. ##################################Service function#################################
  702.  
  703. function Service{
  704. progressbar
  705.  
  706. $outputBox.Clear()
  707. $statusBar.Text=("Processing the request")
  708. $computers=$InputBox.lines.Split("`n")
  709. $sname =$filterbox.text
  710. $date =Get-Date
  711. $ct = "Task Completed @ " + $date
  712. $Script:formt.Visible=$true
  713. $infserv =@()
  714. foreach ($computer in $computers)
  715. {
  716. $Script:formt.text="Working on $computer"
  717. #$s= Get-Service -ComputerName $computer -Name $sname| Select-Object MachineName,Name,Status | ft -AutoSize | Out-String
  718. $infserv +=Get-WmiObject -Class win32_service -ComputerName $computer -Filter "Name Like '%$sname%'" | Select-Object PSComputerName,Name,StartMode,State
  719. $s = $infserv| ft -AutoSize | Out-String
  720. }
  721. $outputBox.Appendtext("{0}`n" -f $s+"`n $ct")
  722. $statusBar.Text=("Ready")
  723. $Script:formt.close()
  724.  
  725. }
  726.  
  727.  
  728. ##################################Service function end #################################
  729.  
  730.  
  731.  
  732.  
  733. ####################################################memmoryFunctions ###start#########################
  734.  
  735.  
  736.  
  737.  
  738. Function Get-MemmoryUtlizatio ($ComputerName=$ENV:ComputerName) {
  739. Get-WmiObject Win32_OperatingSystem -ComputerName $ComputerName |
  740. Select @{Name="Servername";Expression = {$_.__Server}},
  741. @{Name = "TotalGB";Expression = {[int]($_.TotalVisibleMemorySize/1mb)}},
  742. @{Name = "MemoryUsage"; Expression = {“{0:N2}” -f ((($_.TotalVisibleMemorySize - $_.FreePhysicalMemory)*100)/ $_.TotalVisibleMemorySize) }},
  743. @{Name = "FreeGB";Expression = {[math]::Round($_.FreePhysicalMemory/1mb,2)}},
  744. @{Name = "PercentFree%"; Expression = {[math]::Round(($_.FreePhysicalMemory/$_.TotalVisibleMemorySize)*100,2)}}
  745. }
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752. function Memmoryuse {
  753.  
  754. progressbar
  755. $outputBox.Clear()
  756. $statusBar.Text=("Processing the request")
  757. $computers=$InputBox.lines.Split("`n")
  758. $date =Get-Date
  759. $ct = "Task Completed @ " + $date
  760. $Script:formt.Visible=$true
  761. $infoms =@()
  762. foreach ($computer in $computers)
  763. {
  764. $Script:formt.text="Working on $computer"
  765. $infoms += Get-MemmoryUtlizatio $computer
  766. $mres = $infoms |ft -AutoSize | Out-String
  767. }
  768. $outputBox.Appendtext("{0}`n" -f $mres + "`n $ct" )
  769. $statusBar.Text=("Ready")
  770. $Script:formt.close()
  771. }
  772.  
  773. ####################################memmory function end#####################################################
  774.  
  775.  
  776. ####################################################Installed Appst##########################################
  777.  
  778.  
  779.  
  780. function Get-InstalledApps
  781. {
  782. [CmdletBinding()]
  783. [OutputType([int])]
  784. Param
  785. (
  786.  
  787. [Parameter(Mandatory=$true,
  788. ValueFromPipelineByPropertyName=$true,
  789. Position=0)]
  790. $computer
  791. )
  792.  
  793. Begin
  794. {
  795. }
  796.  
  797. Process
  798. {
  799. $win32_product = @(get-wmiobject -class ‘Win32_Product’ -computer $computer)
  800.  
  801. foreach ($app in $win32_product){
  802. $applications = New-Object PSObject -Property @{
  803. Name = $app.Name
  804. Version = $app.Version
  805. InstallDate=$app.InstallDate
  806. Computername=$app.PSComputerName
  807. }
  808.  
  809. Write-Output $applications | Select-Object Computername,Name,Version, InstallDate
  810. }
  811. }
  812.  
  813. End
  814. {
  815. }
  816. }
  817.  
  818.  
  819.  
  820.  
  821. function Applist {
  822.  
  823. progressbar
  824. $outputBox.Clear()
  825. $statusBar.Text=("Processing the request")
  826. $computers=$InputBox.lines.Split("`n")
  827. $date =Get-Date
  828. $ct = "Task Completed @ " + $date
  829. $Script:formt.Visible=$true
  830. foreach ($computer in $computers)
  831. {
  832. $Script:formt.text="Working on $computer"
  833. $m = Get-InstalledApps $computer |Out-String
  834. Write-Host $m | ft -AutoSize
  835.  
  836. $outputBox.Appendtext("{0}`n" -f $m +"`n $ct" )
  837. $statusBar.Text=("Ready")
  838. $Script:formt.close()
  839. }
  840.  
  841.  
  842. }
  843. ####################################################Installed Appstend#############################################
  844.  
  845. ######################################################################
  846. # Powershell script to get the the Services on remote servers
  847. # It will give the services status
  848. # Customized script useful to every one
  849. # Please contact mllsatyanarayana@gmail.com for any suggestions#
  850. #########################################################################
  851.  
  852.  
  853.  
  854. function Get-servies
  855. {
  856. [CmdletBinding()]
  857. [OutputType([int])]
  858. Param
  859. (
  860.  
  861. [Parameter(Mandatory=$true,
  862. ValueFromPipelineByPropertyName=$true,
  863. Position=0)]
  864. $computer
  865. )
  866.  
  867. Begin
  868. {
  869. }
  870.  
  871. Process
  872. {
  873. $win32_product = @(get-wmiobject -class ‘win32_service’ -computer $computer)
  874.  
  875. foreach ($app in $win32_product){
  876. $applications = New-Object PSObject -Property @{
  877. Name = $app.Name
  878. StartMode = $app.StartMode
  879. State=$app.State
  880. Computername=$app.PSComputerName
  881. }
  882.  
  883. Write-Output $applications | Select-Object Computername,Name,StartMode, State
  884. }
  885. }
  886.  
  887. End
  888. {
  889. }
  890. }
  891.  
  892.  
  893.  
  894.  
  895. function Get-ser {
  896.  
  897. progressbar
  898. $outputBox.Clear()
  899. $statusBar.Text=("Processing the request")
  900. $computers=$InputBox.lines.Split("`n")
  901. $date =Get-Date
  902. $ct = "Task Completed @ " + $date
  903. $Script:formt.Visible=$true
  904. $infser =@()
  905. foreach ($computer in $computers)
  906. {
  907. $Script:formt.text="Working on $computer"
  908. $infser += Get-servies $computer
  909. $sl = $infser| ft -AutoSize |Out-String
  910. }
  911. $outputBox.Appendtext("{0}`n" -f $sl +"`n $ct" )
  912. $statusBar.Text=("Ready")
  913. $Script:formt.close()
  914. }
  915.  
  916.  
  917.  
  918.  
  919. ####function end###
  920.  
  921.  
  922.  
  923. #########################################HOTFIX################################
  924. function Get-hotfixes
  925. {
  926. [CmdletBinding()]
  927. [OutputType([int])]
  928. Param
  929. (
  930.  
  931. [Parameter(Mandatory=$true,
  932. ValueFromPipelineByPropertyName=$true,
  933. Position=0)]
  934. $computer
  935. )
  936.  
  937. Begin
  938. {
  939. }
  940.  
  941. Process
  942. {
  943. $win32_product = @(get-wmiobject -class ‘Win32_QuickfixEngineering’ -computer $computer)
  944.  
  945. foreach ($app in $win32_product){
  946. $applications = New-Object PSObject -Property @{
  947. Name = $app.Name
  948. Description = $app.Description
  949. HotFixID=$app.HotFixID
  950. InstalledBy=$app.InstalledBy
  951. InstalledOn=$app.InstalledOn
  952. Computername=$app.PSComputerName
  953. }
  954.  
  955. Write-Output $applications | Select-Object Computername,HotFixID ,InstalledBy, InstalledOn
  956. }
  957. }
  958.  
  959. End
  960. {
  961. }
  962. }
  963.  
  964.  
  965. function Get-update {
  966. progressbar
  967. $outputBox.Clear()
  968. $statusBar.Text=("Processing the request")
  969. $computers=$InputBox.lines.Split("`n")
  970. $date =Get-Date
  971. $ct = "Task Completed @ " + $date
  972. $Script:formt.Visible=$true
  973. foreach ($computer in $computers)
  974. {
  975. $Script:formt.text="Working on $computer"
  976. $m = Get-hotfixes $computer | ft -AutoSize|Out-String
  977.  
  978.  
  979. $outputBox.Appendtext("{0}`n" -f $m +"`n $ct" )
  980. $statusBar.Text=("Ready")
  981. $Script:formt.close()
  982. }
  983.  
  984.  
  985. }
  986.  
  987. #########################################HOTFIXEND################################
  988.  
  989.  
  990.  
  991. ############################################OSTYPE#####################################
  992.  
  993. function Get-ostype
  994. {
  995. [CmdletBinding()]
  996. [OutputType([int])]
  997. Param
  998. (
  999.  
  1000. [Parameter(Mandatory=$true,
  1001. ValueFromPipelineByPropertyName=$true,
  1002. Position=0)]
  1003. $computer
  1004. )
  1005.  
  1006. Begin
  1007. {
  1008. }
  1009.  
  1010. Process
  1011. {
  1012. $win32_product = @(get-wmiobject -class ‘ Win32_OperatingSystem ’ -computer $computer)
  1013.  
  1014. foreach ($app in $win32_product){
  1015. $applications = New-Object PSObject -Property @{
  1016. Name = $app.Name
  1017. caption = $app.caption
  1018. OSArchitecture=$app.OSArchitecture
  1019. ServicePackMajorVersion=$app.ServicePackMajorVersion
  1020. Computername=$app.PSComputerName
  1021. }
  1022.  
  1023. Write-Output $applications | Select-Object Computername, caption,OSArchitecture, ServicePackMajorVersion
  1024. }
  1025. }
  1026.  
  1027. End
  1028. {
  1029. }
  1030. }
  1031.  
  1032.  
  1033. function Get-osv {
  1034. progressbar
  1035. $outputBox.Clear()
  1036. $statusBar.Text=("Processing the request")
  1037. $computers=$InputBox.lines.Split("`n")
  1038. $date =Get-Date
  1039. $ct = "Task Completed @ " + $date
  1040. $Script:formt.Visible=$true
  1041. $osver =@()
  1042. foreach ($computer in $computers)
  1043. {
  1044. $Script:formt.text="Working on $computer"
  1045. $osver += Get-ostype $computer
  1046. $osvr = $osver | ft -AutoSize|Out-String
  1047. }
  1048. $outputBox.Appendtext("{0}`n" -f $osvr+"`n $ct" )
  1049. $statusBar.Text=("Ready")
  1050. $Script:formt.close()
  1051. }
  1052.  
  1053.  
  1054.  
  1055.  
  1056. ############################################OSTYPE#####################################
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063. ####################serial start####################################################################
  1064.  
  1065. function get-serial {
  1066. param(
  1067. $computername =$env:computername
  1068. )
  1069.  
  1070. $os = Get-WmiObject Win32_bios -ComputerName $computername -ea silentlycontinue
  1071. if($os){
  1072.  
  1073. $SerialNumber =$os.SerialNumber
  1074.  
  1075. $servername=$os.PSComputerName
  1076.  
  1077.  
  1078.  
  1079.  
  1080. $results =new-object psobject
  1081.  
  1082. $results |Add-Member noteproperty SerialNumber $SerialNumber
  1083. $results |Add-Member noteproperty ComputerName $servername
  1084.  
  1085.  
  1086.  
  1087. #Display the results
  1088.  
  1089. $results | Select-Object computername,SerialNumber
  1090.  
  1091. }
  1092.  
  1093.  
  1094. else
  1095.  
  1096. {
  1097.  
  1098. $results =New-Object psobject
  1099.  
  1100. $results =new-object psobject
  1101. $results |Add-Member noteproperty SerialNumber "Na"
  1102. $results |Add-Member noteproperty ComputerName $servername
  1103.  
  1104.  
  1105.  
  1106. #display the results
  1107.  
  1108. $results | Select-Object computername,SerialNumber
  1109.  
  1110.  
  1111.  
  1112.  
  1113. }
  1114.  
  1115.  
  1116.  
  1117. }
  1118.  
  1119. $infserial =@()
  1120.  
  1121.  
  1122. foreach($allserver in $allservers){
  1123.  
  1124. $infserial += get-serial $allserver
  1125. }
  1126.  
  1127. $infserial
  1128.  
  1129.  
  1130. function Get-hwserial {
  1131. progressbar
  1132. $outputBox.Clear()
  1133. $statusBar.Text=("Processing the request")
  1134. $computers=$InputBox.lines.Split("`n")
  1135. $date =Get-Date
  1136. $ct = "Task Completed @ " + $date
  1137. $Script:formt.Visible=$true
  1138. $infserial =@()
  1139. foreach ($computer in $computers)
  1140. {
  1141. $Script:formt.text="Working on $computer"
  1142. $infserial += Get-serial $computer
  1143. $res = $infserial | ft -AutoSize | Out-String
  1144. }
  1145. $outputBox.Appendtext("{0}`n" -f $res +"`n $ct" )
  1146. $statusBar.Text=("Ready")
  1147. $Script:formt.close()
  1148.  
  1149. }
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155. ####################serial start###############################################################
  1156.  
  1157.  
  1158. #############Bios start#######################################################################
  1159. function get-Bios {
  1160. param(
  1161. $computername =$env:computername
  1162. )
  1163.  
  1164. $os = Get-WmiObject Win32_bios -ComputerName $computername -ea silentlycontinue
  1165. if($os){
  1166.  
  1167. $SerialNumber =$os.SerialNumber
  1168. $servername=$os.PSComputerName
  1169. $Name= $os.Name
  1170. $SMBIOSBIOSVersion=$os.SMBIOSBIOSVersion
  1171. $Manufacturer=$os.Manufacturer
  1172.  
  1173.  
  1174.  
  1175.  
  1176. $results =new-object psobject
  1177.  
  1178. $results |Add-Member noteproperty SerialNumber $SerialNumber
  1179. $results |Add-Member noteproperty ComputerName $servername
  1180. $results |Add-Member noteproperty Name $Name
  1181. $results |Add-Member noteproperty SMBIOSBIOSVersion $SMBIOSBIOSVersion
  1182. $results |Add-Member noteproperty Manufacture $Manufacture
  1183.  
  1184.  
  1185.  
  1186. #Display the results
  1187.  
  1188. $results | Select-Object computername,SMBIOSBIOSVersion,Name,Manufacture ,SerialNumber
  1189.  
  1190. }
  1191.  
  1192.  
  1193. else
  1194.  
  1195. {
  1196.  
  1197.  
  1198. $results =new-object psobject
  1199.  
  1200. $results |Add-Member noteproperty SerialNumber "Na"
  1201. $results |Add-Member noteproperty ComputerName $servername
  1202. $results |Add-Member noteproperty Name $Name
  1203. $results |Add-Member noteproperty SMBIOSBIOSVersion $SMBIOSBIOSVersion
  1204. $results |Add-Member noteproperty Manufacture $Manufacture
  1205.  
  1206.  
  1207.  
  1208. #display the results
  1209.  
  1210.  
  1211. $results | Select-Object computername,SMBIOSBIOSVersion,Name,Manufacture ,SerialNumber
  1212.  
  1213.  
  1214.  
  1215.  
  1216. }
  1217.  
  1218.  
  1219.  
  1220. }
  1221.  
  1222. $infbios =@()
  1223.  
  1224.  
  1225. foreach($allserver in $allservers){
  1226.  
  1227. $infbios += get-Bios $allserver
  1228. }
  1229.  
  1230. $infbios
  1231.  
  1232.  
  1233.  
  1234. function bios {
  1235. progressbar
  1236. $outputBox.Clear()
  1237. $statusBar.Text=("Processing the request")
  1238. $computers=$InputBox.lines.Split("`n")
  1239. $date =Get-Date
  1240. $ct = "Task Completed @ " + $date
  1241. $Script:formt.Visible=$true
  1242. $infbios =@()
  1243. foreach ($computer in $computers)
  1244. {
  1245. $Script:formt.text="Working on $computer"
  1246. $infbios += get-Bios $computer
  1247. $res = $infbios | ft -AutoSize | Out-String
  1248. }
  1249. $outputBox.Appendtext("{0}`n" -f $res +"`n $ct" )
  1250. $statusBar.Text=("Ready")
  1251. $Script:formt.close()
  1252. }
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. #############################Bios start#######################################################################
  1259.  
  1260. ###############################################pstart###########################################
  1261.  
  1262. function checkport {
  1263. param(
  1264. $computername =$env:computername
  1265. )
  1266. $sname =$filterbox.text
  1267. $os = Test-NetConnection -ComputerName $computername -port $sname -ea silentlycontinue
  1268. if($os){
  1269.  
  1270. $TcpTestSucceeded =$os.TcpTestSucceeded
  1271.  
  1272. $servername=$os.ComputerName
  1273.  
  1274.  
  1275.  
  1276.  
  1277. $results =new-object psobject
  1278.  
  1279. $results |Add-Member noteproperty TcpTestSucceeded $TcpTestSucceeded
  1280. $results |Add-Member noteproperty ComputerName $servername
  1281.  
  1282.  
  1283.  
  1284. #Display the results
  1285.  
  1286. $results | Select-Object computername,TcpTestSucceeded
  1287.  
  1288. }
  1289.  
  1290.  
  1291. else
  1292.  
  1293. {
  1294.  
  1295. $results =New-Object psobject
  1296.  
  1297. $results =new-object psobject
  1298. $results |Add-Member noteproperty TcpTestSucceeded "Na"
  1299. $results |Add-Member noteproperty ComputerName $servername
  1300.  
  1301.  
  1302.  
  1303. #display the results
  1304.  
  1305. $results | Select-Object computername,TcpTestSucceeded
  1306.  
  1307.  
  1308.  
  1309.  
  1310. }
  1311.  
  1312.  
  1313.  
  1314. }
  1315.  
  1316. $infoport =@()
  1317.  
  1318.  
  1319. foreach($allserver in $allservers){
  1320.  
  1321. $infoport += checkport $allserver
  1322. }
  1323.  
  1324. $infoport
  1325.  
  1326.  
  1327. function Get-portstatus {
  1328. progressbar
  1329. $outputBox.Clear()
  1330. $statusBar.Text=("Processing the request")
  1331. $computers=$InputBox.lines.Split("`n")
  1332. $date =Get-Date
  1333. $ct = "Task Completed @ " + $date
  1334. $Script:formt.Visible=$true
  1335. $infoport =@()
  1336. foreach ($computer in $computers)
  1337. {
  1338. $Script:formt.text="Working on $computer"
  1339. $infoport += checkport $computer
  1340. $pres= $infoport| ft -AutoSize | Out-String
  1341. }
  1342. $outputBox.Appendtext("{0}`n" -f $pres +"`n $ct")
  1343. $statusBar.Text=("Ready")
  1344. $Script:formt.close()
  1345. }
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351. ###############################################pstartend###########################################
  1352.  
  1353.  
  1354. function exit{
  1355. $global:QUIT = $true
  1356.  
  1357. $objForm.Close()
  1358. }
  1359.  
  1360.  
  1361.  
  1362.  
  1363. ############local admin start###########
  1364.  
  1365. function get-localadmin {
  1366. param ($computerName)
  1367.  
  1368. $admins = Gwmi win32_groupuser –computer $computerName
  1369. $admins = $admins |? {$_.groupcomponent –like '*"Administrators"'}
  1370.  
  1371. $admins |% {
  1372. $_.partcomponent –match “.+Domain\=(.+)\,Name\=(.+)$” > $nul
  1373. $matches[1].trim('"') + “\” + $matches[2].trim('"')
  1374. }
  1375. }
  1376.  
  1377.  
  1378. $inflocaladmin =@()
  1379.  
  1380.  
  1381. foreach($allserver in $allservers){
  1382.  
  1383. $inflocaladmin += get-localadmin $allserver
  1384. }
  1385.  
  1386. $inflocaladmin
  1387.  
  1388.  
  1389. function Localadmins{
  1390. progressbar
  1391. $outputBox.Clear()
  1392. $statusBar.Text=("Processing the request")
  1393. $computers=$InputBox.lines.Split("`n")
  1394. $date =Get-Date
  1395. $ct = "Task Completed @ " + $date
  1396. $Script:formt.Visible=$true
  1397. $inflocaladmin =@()
  1398. foreach ($computer in $computers)
  1399. {
  1400. $Script:formt.text="Working on $computer"
  1401. $inflocaladmin += get-localadmin $computer
  1402. $infres = $inflocaladmin| ft -AutoSize|Out-String
  1403. }
  1404. $outputBox.Appendtext("{0}`n" -f $infres +"`n $ct" )
  1405. $statusBar.Text=("Ready")
  1406.  
  1407. $Script:formt.close()
  1408. }
  1409.  
  1410.  
  1411.  
  1412. ############local admin function ends###########
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419. ################CPU Function Start#############################################
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426. function Get-Cpu{
  1427. param(
  1428. $computername =$env:computername
  1429. )
  1430. $os = gwmi win32_perfformatteddata_perfos_processor -ComputerName $computername| ? {$_.name -eq "_total"} | select -ExpandProperty PercentProcessorTime -ea silentlycontinue
  1431. if(($os -match '\d+') -or ($os -eq '0')){
  1432. $results =new-object psobject
  1433. $results |Add-Member noteproperty Cputil $os
  1434. $results |Add-Member noteproperty ComputerName $computername
  1435. $results | Select-Object computername,Cputil
  1436. }
  1437. else{
  1438. $results =new-object psobject
  1439. $results |Add-Member noteproperty Cputil "Na"
  1440. $results |Add-Member noteproperty ComputerName $computername
  1441. $results | Select-Object computername,Cputil
  1442. }
  1443. }
  1444.  
  1445.  
  1446.  
  1447. function cpu {
  1448. progressbar
  1449. $outputBox.Clear()
  1450. $statusBar.Text=("Processing the request")
  1451. $computers=$InputBox.lines.Split("`n")
  1452. $date =Get-Date
  1453. $ct = "Task Completed @ " + $date
  1454. $Script:formt.Visible=$true
  1455. $infcpu =@()
  1456. foreach ($computer in $computers)
  1457.  
  1458. {
  1459. $Script:formt.text="Working on $computer"
  1460. $infcpu += get-Cpu $computer
  1461. $res = $infcpu | ft -AutoSize | Out-String
  1462. }
  1463. $outputBox.Appendtext("{0}`n" -f $res +"`n $ct" )
  1464. $statusBar.Text=("Ready")
  1465. $Script:formt.close()
  1466. }
  1467.  
  1468. ################CPU Function end#############################################
  1469.  
  1470.  
  1471. ##################Processfunction Start########################################
  1472.  
  1473. Function Processutil ($computerName=$env:COMPUTERNAME) {
  1474.  
  1475. if ($osp = Get-wmiobject win32_process -ComputerName $ComputerName | where{$_.name -like "*$sname*"} | Sort ws -desc | ft Pscomputername,Name,ProcessId,@{Name="Mem Useage (MB)";Expression={[math]::round($_.ws / 1mb)}} -AutoSize )
  1476. {
  1477. $osp
  1478. }
  1479. else
  1480. {
  1481. $outputbox.text = "Server offlne or no process running"
  1482. }
  1483. }
  1484.  
  1485.  
  1486. function proc {
  1487.  
  1488. progressbar
  1489. $outputBox.Clear()
  1490. $statusBar.Text=("Processing the request")
  1491. $computers=$InputBox.lines.Split("`n")
  1492. $date =Get-Date
  1493. $sname =$filterbox.text
  1494. $ct = "Task Completed @ " + $date
  1495. $Script:formt.Visible=$true
  1496. $infproc =@()
  1497. foreach ($computer in $computers)
  1498. {
  1499. $Script:formt.text="Working on $computer"
  1500. $infproc += Processutil $computer
  1501. $pres = $infproc| ft -AutoSize | Out-String
  1502. }
  1503. $outputBox.Appendtext("{0}`n" -f $pres +"`n $ct" )
  1504. $statusBar.Text=("Ready")
  1505. $Script:formt.close()
  1506. }
  1507.  
  1508.  
  1509.  
  1510. ##################Processfunction Start########################################
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517. function SAeventlogs{
  1518. progressbar
  1519. $outputBox.Clear()
  1520. $statusBar.Text=("Processing the request")
  1521. $date=Get-Date
  1522. $computers=$InputBox.lines.Split("`n")
  1523. $evs =$Dropdown.SelectedItem.ToString()
  1524. $app= $evs
  1525. $args = @{}
  1526. $args.Add("StartTime", ((Get-Date).AddHours(-24)))
  1527. $args.Add("EndTime", (Get-Date))
  1528. $args.Add("LogName", $app)
  1529. $ct = "Task Completed @ " + $date
  1530. $sname =$filterbox.text
  1531. $Script:formt.Visible=$true
  1532. $infev =@()
  1533. foreach ($computer in $computers)
  1534. {
  1535. $Script:formt.text="Working on $computer"
  1536. $infev += Get-winevent -FilterHashtable $args -ComputerName $computer| Where-Object {($_.Message -match "$sname") -or ($_.ID -match "$sname")} |Select-Object Machinename,ID,Timecreated,Message
  1537. $evResult =$infev | ft -AutoSize -Wrap | Out-String
  1538. }
  1539. $outputBox.Appendtext("{0}`n" -f $evResult + "`n $ct")
  1540. $statusBar.Text=("Ready")
  1541. $Script:formt.close()
  1542. }
  1543.  
  1544. ##################################################Nic Start ###############
  1545.  
  1546. function NetIPdetails ($computerName=$env:COMPUTERNAME)
  1547. {
  1548.  
  1549. foreach ($Computer in $ComputerName) {
  1550. if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
  1551. try {
  1552. $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer -EA Stop | ? {$_.IPEnabled}
  1553. } catch {
  1554. Write-Warning "Error occurred while querying $computer."
  1555. Continue
  1556. }
  1557. foreach ($Network in $Networks) {
  1558. $IPAddress = $Network.IpAddress[0]
  1559. $SubnetMask = $Network.IPSubnet[0]
  1560. $DefaultGateway = $Network.DefaultIPGateway
  1561. $DNSServers = $Network.DNSServerSearchOrder
  1562. $Description = $Network.Description
  1563. $WINS1 = $Network.WINSPrimaryServer
  1564. $WINS2 = $Network.WINSSecondaryServer
  1565. $WINS = @($WINS1,$WINS2)
  1566. $IsDHCPEnabled = $false
  1567. If($network.DHCPEnabled) {
  1568. $IsDHCPEnabled = $true
  1569. }
  1570. $MACAddress = $Network.MACAddress
  1571. $OutputObj = New-Object -Type PSObject
  1572. $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
  1573. $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
  1574. $OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
  1575. $OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value ($DefaultGateway -join ",")
  1576. $OutputObj | Add-Member -MemberType NoteProperty -Name IsDHCPEnabled -Value $IsDHCPEnabled
  1577. $OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value ($DNSServers -join ",")
  1578. $OutputObj | Add-Member -MemberType NoteProperty -Name Description -Value $Description
  1579. $OutputObj | Add-Member -MemberType NoteProperty -Name WINSServers -Value ($WINS -join ",")
  1580. $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
  1581. $OutputObj
  1582. }
  1583. }
  1584. }
  1585. }
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591. function Nic {
  1592.  
  1593. progressbar
  1594. $outputBox.Clear()
  1595. $statusBar.Text=("Processing the request")
  1596. $computers=$InputBox.lines.Split("`n")
  1597. $date =Get-Date
  1598. $sname =$filterbox.text
  1599. $ct = "Task Completed @ " + $date
  1600. $Script:formt.Visible=$true
  1601. $infnic =@()
  1602. foreach ($computer in $computers)
  1603. {
  1604. $Script:formt.text="Working on $computer"
  1605. $infnic += NetIPdetails $computer
  1606. $nres = $infnic| ft -AutoSize | Out-String
  1607. }
  1608. $outputBox.Appendtext("{0}`n" -f $nres +"`n $ct" )
  1609. $statusBar.Text=("Ready")
  1610. $Script:formt.close()
  1611. }
  1612. ##################################################End of the function###############
  1613.  
  1614.  
  1615. function Get-ActivationStatus {
  1616. [CmdletBinding()]
  1617. param(
  1618. [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
  1619. [string]$DNSHostName = $Env:COMPUTERNAME
  1620. )
  1621. process {
  1622. try {
  1623. $wpa = Get-WmiObject SoftwareLicensingProduct -ComputerName $DNSHostName `
  1624. -Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f'" `
  1625. -Property LicenseStatus -ErrorAction Stop
  1626. } catch {
  1627. $status = New-Object ComponentModel.Win32Exception ($_.Exception.ErrorCode)
  1628. $wpa = $null
  1629. }
  1630. $out = New-Object psobject -Property @{
  1631. ComputerName = $DNSHostName;
  1632. Status = [string]::Empty;
  1633. }
  1634. if ($wpa) {
  1635. :outer foreach($item in $wpa) {
  1636. switch ($item.LicenseStatus) {
  1637. 0 {$out.Status = "Unlicensed"}
  1638. 1 {$out.Status = "Licensed"; break outer}
  1639. 2 {$out.Status = "Out-Of-Box Grace Period"; break outer}
  1640. 3 {$out.Status = "Out-Of-Tolerance Grace Period"; break outer}
  1641. 4 {$out.Status = "Non-Genuine Grace Period"; break outer}
  1642. 5 {$out.Status = "Notification"; break outer}
  1643. 6 {$out.Status = "Extended Grace"; break outer}
  1644. default {$out.Status = "Unknown value"}
  1645. }
  1646. }
  1647. } else { $out.Status = $status.Message }
  1648. $out
  1649. }
  1650. }
  1651.  
  1652.  
  1653. function WLA {
  1654.  
  1655. progressbar
  1656. $outputBox.Clear()
  1657. $statusBar.Text=("Processing the request")
  1658. $computers=$InputBox.lines.Split("`n")
  1659. $date =Get-Date
  1660. $sname =$filterbox.text
  1661. $ct = "Task Completed @ " + $date
  1662. $Script:formt.Visible=$true
  1663. $infwl =@()
  1664. foreach ($DNSHostName in $computers)
  1665. {
  1666. $Script:formt.text="Working on $computer"
  1667. $infwl += Get-ActivationStatus $DNSHostName
  1668. $wlres = $infwl| ft -AutoSize | Out-String
  1669. }
  1670. $outputBox.Appendtext("{0}`n" -f $wlres+"`n $ct" )
  1671. $statusBar.Text=("Ready")
  1672. $Script:formt.close()
  1673. }
  1674.  
  1675.  
  1676. [void]$Form.ShowDialog()
  1677. $Form.Dispose()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement