Quantcast
Channel: Active questions tagged powershell-3.0 - Stack Overflow
Browsing latest articles
Browse All 149 View Live
↧

How to execute a CMD file in remote computer

I am looking to execute a command in remote machine using invoke but the .cmd file will call for additional .vbs script. So i guess i may have to mention CScript if so how do i mention both cmd/c and...

View Article


Configuring "Do not forcefully unload the users registry at user logoff" in...

I need to write a PowerShell script that should configure the below settings of Group policy in all the machines.Gpedit.msc → Computer Configuration → Administrative Templates → System → User Profiles...

View Article


Can't Activate Document in Pipeline (unix script)

I'm trying to run the program bayes-seg with: cat data/books/clinical/050.ref | ./segment config/dp.config using Powershell. I understand that the command cat outputs the file and pipe will use the...

View Article

"Access to the path is denied" when attempting to redirect output to a file

I'm trying to redirect console output from a TFS command to a file with the following command:witadmin listfields /collection:blahblah:8080/tfs/TPC > TFSfields.txtbut I get an error:"Access to the...

View Article

Invoke-Command with -credentials

I want to invoke a command on a remote server, I do not want to have to put in the password to run the script. I've tried encrypting the password and storing it in a txt file. $username =...

View Article


A PowerShell Script to install fonts on Windows 11

I would like help with the following ps script that I took from reddit to install fonts for all Windows 11 users, below is the original script:#set font source location$FontFolder = "FONT...

View Article

Launch Elevated CMD.exe from Powershell

I am trying to launch an elevated CMD window from PowerShell but I am running into some issues. Below is the Code I have now. There is an admin account on the machine that has the username of "test"...

View Article

How do I write a value to an OPC tag in kepware using PowerShell

How do I write/update the value of tag2 in Kepware using PowerShell. This is my code example and I am getting the errorInvoke-RestMethod : The remote server returned an error: (400) Bad Request.At...

View Article


Enter-Pssession not working

I have to machines in same network one with windows7 and another win windows server 2012.I tried Enter-PSsession on windows7 machine from server2012 machine... $ComputerName = "windows7-PC"...

View Article


Replace-Files Powershell

I'm having some struggles with my PowerShell script. I am trying to make an Automated Script that will Perform the Utilman.exe Hack. The script has menus and options: Load, Unload, List Disk and Create...

View Article

How to remove property header from output when runnign Get-ADComputer

I want to pull the names of computer objects in AD in to a file. The method I'm trying so far is this$computers = Get-ADComputer -Filter * | Format-List namewrite($computers) | Out-File -FilePath...

View Article

How to properly export XML to file using Powershell

Importing any valid XML file as source using [XML]$Var = Get-Content -Path $PathToAnyValidXML I am unable to export it's content properly. Using Set-Content SomePath $Var , the file ends with...

View Article

Easier way to parse 'query user' in PowerShell (or quser)

I currently have the following query in PowerShell:query user /server:$serverWhich returns output:USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME svc_chthost 2 Disc 1:05 8/16/2016 12:01 PM...

View Article


Suppressing VERBOSE for Import-Module

I'm importing Carbon into my PowerShell script; however when running my script with -Verbose, Carbon also outputs a lot of VERBOSE statements.Is it possible to Import-Module silently such that I can...

View Article

exporting from powershell to txt file

I'm trying to set up a scope on dhcp via powershell and export info to txt file. My code does what it needs to do, but when i export to txtfile with | out file it only exports the reserved ip not the...

View Article


PowerShell 3: Every Command Execution Results In "The type initializer [...]...

DescriptionI've installed the new PowerShell version on my system a few months ago. Since that, something strange happens every time I use the shell. It doesn't trouble the functionality, but it's...

View Article

Powershell: Scheduled Task with Daily Trigger and Repetition Interval

I cant seem to figure out how to create a new scheduled task that is triggered daily and repeats every 30 minutes. I have been going in circles.Everything about this below works for setting the task I...

View Article


How can I extract "Path to executable" of all services with PowerShell

Get-Service *sql* | sort DisplayName | out-file c:/servicelist.txtI have a one line PowerShell script to extract list of all services running on my local machine, now, in addition to displaying...

View Article

Restore multiple analysis databases from Windows explorer with Powershell

I am trying to maken a PS script that retores multiple analysis databases to SSAS from Windows explorer.Here are the databases F:\\Backup\\SSAS\\SQL002\\, xx.abf and yy.abf and many more.This is the...

View Article

List of all colors available for PowerShell?

I am searching for a list of all colors I can use in PowerShell. Since we need to provide names and no hexnumbers, it's hard to figure out if a color exists or not, at least if you don't know how...

View Article

Get error when doing Enter-PSSession - Connecting to remote server failed

I'm trying to remote on to another computer (an aws workspace) and using: Enter-PSSession -ComputerName [IP-ADDRESS] -Credential $credBut get error:Enter-PSSession : Connecting to remote server...

View Article


Automate process of Disk Cleanup cleanmgr.exe without user intervention

I am developing a powershell script file which shall execute some disk cleanup without user intervention. The user shall not be able to configure anything.When I run cleanmgr.exe /d c: sageset:1 a...

View Article


Get value from JSON using string from array [duplicate]

What I'm trying to do is getting one specific value from nested JSON. Using array keys as expression.Array with keys and values: $AccountService = @{'root.branch.setting1'=...

View Article

Powershell: Set a Scheduled Task to run when user isn't logged in

I have been using the Powershell Scheduled Task Cmdlets to create a scheduled task on our servers.How do I elect to 'Run whether a user is logged in or not using this API?I've created action, trigger,...

View Article

Windows Powershell shortcut to delete previous command's output

In the macOS terminal application (Terminal.app), there is a shortcut (cmd+l) to delete the previous command's output. Is there such a shortcut in Powershell?

View Article


Trying to run Get-WindowsUpdate on a remote computer but get: Access is...

I've got a powershell script to remote into other computers to get and install windows updates.I'm logged into the admin account on my local machine. The script starts a powershell remote session into...

View Article

Verify Robocopy Operation

I want to run a scheduled script after running a Robocopy Script, which moves files between remote servers.The requirement of this script is that, it will check whether the Robocopy script has...

View Article

Tracing where output is coming from in a Powershell script

Is it possible to trace where output (to the console) is coming from in a Powershell script? I've got a script which is outputting information to me but I'm not sure which line is making the output. Is...

View Article

Difference between PSObject, Hashtable, and PSCustomObject

Can anybody explain the details? If I create an object using$var = [PSObject]@{a=1;b=2;c=3}and then I look for its type using getType() PowerShell tells me it's of type Hashtable.When using Get-Member...

View Article



PowerShell flattening nested JSON and convert it to CSV

I have a JSON file below. I am trying to flatten and convert it to CSV. {"tempid": "template_86CE6E3BE3AD4EAB95727BCBFAD6A83C","auid": "audit_00006F5D7A114CE59AD572E3E878E726","created_at":...

View Article
Browsing latest articles
Browse All 149 View Live


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