gpo
3 TopicsPowershell command on domain computers as administrator
Hi, I want to execute a command on all computers in my domain but in order for it to work, it needs to run with elevated permissions. Is there a possibility to do this? my command: get-winevent -filterXML([xml](Get-Content "C:\Execute\Inventorview.xml")) | sort timecreated -descending | export-csv c:\execute\result.csv the response i get: get-winevent : Could not retrieve information about the Security log. Error: Poging tot het uitvoeren van een niet-gema chtigde bewerking.. At line:1 char:1 + get-winevent -filterXML([xml](Get-Content "C:\Execute\Inventorview.xm ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-WinEvent], Exception + FullyQualifiedErrorId : LogInfoUnavailable,Microsoft.PowerShell.Commands.GetWinEventCommand (Poging tot het uitvoeren van een niet-gemachtigde bewerking... = dutch for 'trying to execute a non-authorized...') Thanks in advance!4.1KViews0likes3CommentsLogin Script to Popup a Windows Form
Hi, I am trying to popup a form via a PowerShell login script (User Configuration) but the form is getting supressed even when using: $form.Topmost = $true Does anyone know a way via PowerShell I can force the form to popup? I'd like to avoid using the "Run logon scripts visible" setting since its not the only script running and the form will only display when certain criteria are met. I can't post my actual script but its a pretty generic form much like this: Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing $form = New-Object System.Windows.Forms.Form $form.Text = 'Data Entry Form' $form.Size = New-Object System.Drawing.Size(300,200) $form.StartPosition = 'CenterScreen' $okButton = New-Object System.Windows.Forms.Button $okButton.Location = New-Object System.Drawing.Point(75,120) $okButton.Size = New-Object System.Drawing.Size(75,23) $okButton.Text = 'OK' $okButton.DialogResult = [System.Windows.Forms.DialogResult]::OK $form.AcceptButton = $okButton $form.Controls.Add($okButton) $cancelButton = New-Object System.Windows.Forms.Button $cancelButton.Location = New-Object System.Drawing.Point(150,120) $cancelButton.Size = New-Object System.Drawing.Size(75,23) $cancelButton.Text = 'Cancel' $cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel $form.CancelButton = $cancelButton $form.Controls.Add($cancelButton) $label = New-Object System.Windows.Forms.Label $label.Location = New-Object System.Drawing.Point(10,20) $label.Size = New-Object System.Drawing.Size(280,20) $label.Text = 'Please enter the information in the space below:' $form.Controls.Add($label) $textBox = New-Object System.Windows.Forms.TextBox $textBox.Location = New-Object System.Drawing.Point(10,40) $textBox.Size = New-Object System.Drawing.Size(260,20) $form.Controls.Add($textBox) $form.Topmost = $true $form.Add_Shown({$textBox.Select()}) $result = $form.ShowDialog() if ($result -eq [System.Windows.Forms.DialogResult]::OK) { $x = $textBox.Text $x } Any help would be appreciated. Thanks2KViews0likes2CommentsUsing Powershell to Install Python
Hi all A while ago I created a script in powershell to install python and it worked if I was running the script but then I automated it in Jenkins so it ran remotely on the machine. It installs Python Launcher but Control Panel does not show the actual Python inatall, yet regiatry believes it exists. Seems the install is corrupted. Today I did a new script to run via GPO on reatart to install python direct on server and the same issue happens. Python does not package as an msi and thus I need powershell to install it and this needs to be done without human intervention but no matter what I try it always corrupts/fails to fully install (no errors) Does anybody have a solution guaranteed to install? It's doing my head in Prior to install I also run some uninstall commands and registry clearing of old version if that is crucial info though that shouldn't cause issue Thanks for your responses1.9KViews0likes2Comments