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

What’s the PS equivalent of %1 used in CMD?

$
0
0

I made a few one-liners for cmd using net commands for viewing, unlocks, resets, extensions and such. For example:

net user /domain %1 /expires:%2 /active:yes 

My one problem was doing a decent search. I love PS for get-aduser but my usual trick for %1 to pass the usernames… I don’t know how to do this in PS. I’m basically learning by examples as i get an idea or run into a problem. Any advice for how i could pass something like the below where %1 %2 and such are entered following my new-alias for the search command?

get-aduser -filter 'name -like "%1"' 

submitted by /u/sadepanda
[link] [comments]

The post What’s the PS equivalent of %1 used in CMD? appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles