Quantcast
Channel: /r/powershell – How to Code .NET
Browsing all 8793 articles
Browse latest View live

I want to display computer name from entered user name

So I have this $yourusername = Read-Host Get-WMIObject Win32_loggedonuser | Select-String $yourusername but I want to display the PSComputerName from that specific code block submitted by...

View Article


Self healing script question

We have this application called invincea. Its basically a sandbox software for browsers. The application can just randomly malfunction and cause the browser not to open correctly. We have a VB script...

View Article


Test-Path returns false when using an IP and true when using the computer name

Hi /r/PowerShell I was playing around with PowerShell today and found that when using Test-Path against a hidden share using the computers IP address i.e. %IPv4_address%share$ I was getting access...

View Article

DSC – configure pull client LCM for multiple config names

I’m trying to understand how to configure the LCM on pull clients in general, but what I really need to understand is what I set in the LCM configuration script for each client in the config names...

View Article

Get-WMIObject loops back to beginning of content text file when reaches a...

I will preface this with the fact that I am very, very new to PowerShell. I am in the middle of an inventory and would like to be able to grab serial numbers from the Get-WMIObject command. I am...

View Article


PowerScripting Podcast special event this Thursday

submitted by /u/halr9000 [link] [comments] The post PowerScripting Podcast special event this Thursday appeared first on How to Code .NET.

View Article

Dump of Event Viewer Logs

I’m trying to create a script that runs daily to get the logs of a particular Event from Event Viewer and dumps the difference in a log file. So far I’ve managed to create the dump but it’s always...

View Article

Run PowerShell with RunDll32.exe

submitted by /u/p3nt4 [link] [comments] The post Run PowerShell with RunDll32.exe appeared first on How to Code .NET.

View Article


Multiple Compare-Objects not outputting (Stopping after one)

I’m having some issues getting my Compare-Objects to run. Here’s the code: The CSV is any combination of: Name "Doe, Jane" "Smith, Jon" "Doe, John" "Johnson, John" . $Users = Import-Csv -Path...

View Article


Doing some weird stuff with AD groups, filtering them out using several...

I need to find a user’s group and sort them into multiple variables: $Approved groups are groups that aren’t in the $filters array, and the ManagedBy attribute of the group in AD is blank $Denied are...

View Article

Episode 315 – PowerScripting Podcast – Michael Greene (Microsoft) and Steven...

submitted by /u/alinroc [link] [comments] The post Episode 315 – PowerScripting Podcast – Michael Greene (Microsoft) and Steven Murawski (Chef) on the Release Pipeline Model appeared first on How to...

View Article

Passing user-prompted value to multiple variables

I am working on a script to help automate a game my friends and I play. Currently we have to manually enter the point values as we go, and since points are accrued each week we want to build some...

View Article

Export-CSV to Path Variable?

I am trying to write a script that will export a CSV (or any output really) to a variable path destination that any one can use to put the output to the relative same location – like their desktop....

View Article


Get-AdUser -properties $variable

Hi, Im looking for a way to achieve the small script below. I have 5 places in a function where I get-aduser with different filters, but I don’t want to change this on every get-aduser separately. I...

View Article

-if not working…

Why is my warning still showing even after typing a number? Do {$value1= Read-Host -prompt ‘How many shares require Crypto-Detect’ if ($value1 -notcontains (0..100)){Write-Warning ‘Use a number’} }...

View Article


Remove Unlicensed Users from Distrobution Groups O365

All can someone help me proof this script. The goal is to easily and efficiently remove unlicensed users from the o365 distribution lists. <# Remove Unlicensed Distribution Group Members #>...

View Article

Register-ScheduledJob “completed” but not “running” script as intended

I posted this in Stack Overflow as well, the formatting is a little easier to read over there. Here is the link to the question if you’d rather read it on SO:...

View Article


get-printer loop failure

Hi All, Trying to write up a quick script to check if a printer is installed on PC’s within our organization. We don’t have a printer server, and these networked printers are all installed manually on...

View Article

Using PS to run a command line executable and get the verbose output from...

Basically I am running & $cmd $prm $cmd = path to executable $prm = the arguments for the exe. One of them being a verbose flag If I run the exe with the verbose flag in cmd I get the verbose...

View Article

Can’t Run Unsigned Script?

I have Windows 10 Anniversary Update, and I now can’t seem to run Powershell scripts I get from Github? I’m trying to install the Powerline Patched Fonts from https://github.com/powerline/fonts, but...

View Article
Browsing all 8793 articles
Browse latest View live