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

[HELP] variable inside an array

How to get $caption -join “`n” inside an array? When I do the following, it gives me a an unexpected token error. $captions = Get-CimInstance win32_diskdrive | select -expand caption $info = @( System...

View Article


Comparing differently-formatted strings

In a post, /u/mitzenlol was trying to equate CPU-INTEL6700K (from a data file) with Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (from WMI/CIM). This is easy for a human but not a trivial scripting...

View Article


Neophyte question regarding manipulating an array of filenames…

I want to change the extension of each filename in an array, but I don’t want to use rename-item. I have a list of filenames from: $files = Get-ChildItem -Path E:catchwork -Filter *.dv -Recurse Now I...

View Article

[Help] TopN Numbers

Hi All, I’ve been trying to recreate TopN just out of curiosity in PS but I have hit a block on it and wondered if anyone could help me? $nums = New-Object system.collections.stack $topN = 4 $dataFile...

View Article

Click-Once Application with POSH?

Can I turn a powershell script into a click-once .NET app? That’d be nice as not everyone has the latest powershell version and therefore can’t run some scripts without upgrading (if you use new...

View Article


Modifying DWORD value of registry key in HKEY_CLASSES_ROOTCLSID?

I am trying to modify the DWORD value of a registry key under HKEY_CLASSES_ROOTCLSID. The key is a GUID (ie: HKCR:CLSID{018D5C66-4533-4307-9B53-224DE2ED1FE6}) and I can’t seem to get PowerShell to...

View Article

Working on script to get count of users/computers from specific OU’s and...

I’ve been working on this script in some free time over the past week, and feel like I’m either overcomplicating it or am going about this all wrong. The overall goal is to search AD under specific...

View Article

How would I get my output to have these headers?

This is what I want my headers to look like In my current script, I have them saying: InstallDate, Publisher, and DisplayName. How might I go about changing the Publisher and DisplayName to Vendor and...

View Article


How do I “expand” objects the same way that get-childitem does?

If I run get-childitem | select-object * my output looks like this: http://imgur.com/a/HwItc See how it shows some of the various properties that the versioninfo object contains with that nice...

View Article


Rename-Item Error: Assistance Requested

Hi there, I am very new to Powershell and I am trying to write a script that renames a file into something more readable. Below is the line of code that causes the error “Rename-Item : The path is not...

View Article

looking to add a menu bar

I have a powershell form that is just about complete but I am having trouble making a simple menu bar on top such as file help etc. here is my code so far Any help would be much appreciated function...

View Article

Getting all users from all groups in AD

This has probably been asked before but i’m beating my head against the wall here. I don’t script/program very much so i’m having a hard time here. I managed to cobble something together that does...

View Article

Need help with a poorly written For-Each loop

OK so I’m fairly new to PowerShell, and I’m trying to write a script to poll our PDC for A-Records and then hit the hosts enumerated by the A-Records on the server with a function to pull out some...

View Article


PowerShell job security…

submitted by /u/mgratz [link] [comments] The post PowerShell job security… appeared first on How to Code .NET.

View Article

replacing an instance of “word” in text file

I have this code (json) (sorry, access to pastebin right now): [ { "name": "first_rule", "properties": { }, { "name": "two_rule", "properties": { "description": "This is the second rule", }, } ]...

View Article


Anyone aware of a cmdlet that will allow me to set the “restart options” time...

Win 10, settings, security/updates has a Restart Options which exposes a switch to Use a custom restart time, and then to set that time. It also allows you to push it out up to 3 days. Anyone aware of...

View Article

Advice on PowerShell cross domain

Whats peoples opinions on having dedicated PS script/remoting host for different domains? At the moment i run most scripts, functions etc from a single host/domain. Im guessing the answer is it...

View Article


How to access and move a file on the desktop?

I’m currently trying to learn python 3.5 from scratch and on of the beginning exercises is asking me to move a file i created on my desktop to a temporary folder in my C: drive. How does one go about...

View Article

Get the Remote Desktop Services Profile Profile Path

Ive looked everywhere i can only find examples that modify all users. I need to retrieve the path for a single user – can someone help? TBH i’m struggling to find even basic documentation for...

View Article

Active Directory OU reboot script?

Alright, so first things first, I know I’ve posted about this before, but it looks like previous methods aren’t going to work. Group Policy is NOT available to me. I’m working in a military...

View Article
Browsing all 8793 articles
Browse latest View live