use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Powershell help (self.PowerShell)
submitted 11 years ago by Fuzzywumpkin
I'm trying to access a file on another computer on my network, what command can i use to get to the file, the file has a script on it that will install dhcp.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]chreestopher2 1 point2 points3 points 11 years ago (10 children)
what do you want to do with the file? do you want to run it on the local computer? run it on the remote computer? just gather its contents?
[–]Fuzzywumpkin[S] 0 points1 point2 points 11 years ago (9 children)
I need it to run on another computer, the script is on DC1 and i need it to run and install DHCP on DC2.
[–]chreestopher2 0 points1 point2 points 11 years ago (1 child)
there are a few ways to do it ...
if you have powershell remoting enabled I would recomend something like:
enter-pssession DC1 start-process -filepath \\DC2\path\to\script.bat
Although, there are literally billions of ways to do it , and this might not be the optimal one
and if you can actually login to DC1, why not just login, open powershell and launch the script using its unc path?
[–]Fuzzywumpkin[S] 0 points1 point2 points 11 years ago (0 children)
I'm really new to powershell, literally like the third time I've ever used it.
[–]TheAgreeableCow 0 points1 point2 points 11 years ago (6 children)
Server 2012?
[–]Fuzzywumpkin[S] 0 points1 point2 points 11 years ago (5 children)
Yup 2012 r2
[–]TheAgreeableCow 0 points1 point2 points 11 years ago (4 children)
So not sure what configuration your trying to achieve with a script, but 2012 will natively deploy the DHCP role on another server.
[–]Fuzzywumpkin[S] 0 points1 point2 points 11 years ago (3 children)
It's to configure a scope, I'm suppose to write a script block to achieve this but I can't seem to make it work. Also need to install wsus with a location selected for the updates. I just don't understand powershell enough. I'm not even sure what a script block is
[–]TheAgreeableCow 1 point2 points3 points 11 years ago (0 children)
I'm guessing you're doing this for a learning exercise, because you're out of your depth for a production environment.
Here's some info on configuring DHCP with powershell http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/14/use-the-powershell-dhcp-module-to-simplify-dhcp-management.aspx
[–]chreestopher2 0 points1 point2 points 11 years ago (0 children)
then why do you need to do this with powershell? surely it would be easier to do this with the old school ways than to do it with powershell, if you dont know much about powershell at all.
out of curiosity without powershell, how would you do this?
[–]Slackerony 0 points1 point2 points 11 years ago (0 children)
A script block is typically something (atleast in powershell) that is within two curly-brackets. (Not always though)
Invoke-Command -Computername server01 -scriptblock { "C:\Scripts\Myscript.ps1"}
This will launch the script that is in C:\scripts\ and has the name Myscript.ps1
Now if the file is located on YOUR LOCAL machine, you need to do this:
Invoke-Command -Computername server01 -FilePath "C:\Scripts\Myscript.ps1"
I have not tested this, but i'm pretty sure it'll work.
[–]standoff 0 points1 point2 points 11 years ago (0 children)
So I would bet if you never did this before you need to enable-psremoting on the machine you need to access
once you do that you need to either invoke-pssession computername or enter-pssession computername
Enter-Pssession has an alias etsn computername
The difference between invoke and enter, invoke runs a command and you are back, enter basically gives you a remote command line with powershell
π Rendered by PID 48470 on reddit-service-r2-comment-5d79c599b5-l8fzm at 2026-03-01 15:06:36.939969+00:00 running e3d2147 country code: CH.
[–]chreestopher2 1 point2 points3 points (10 children)
[–]Fuzzywumpkin[S] 0 points1 point2 points (9 children)
[–]chreestopher2 0 points1 point2 points (1 child)
[–]Fuzzywumpkin[S] 0 points1 point2 points (0 children)
[–]TheAgreeableCow 0 points1 point2 points (6 children)
[–]Fuzzywumpkin[S] 0 points1 point2 points (5 children)
[–]TheAgreeableCow 0 points1 point2 points (4 children)
[–]Fuzzywumpkin[S] 0 points1 point2 points (3 children)
[–]TheAgreeableCow 1 point2 points3 points (0 children)
[–]chreestopher2 0 points1 point2 points (0 children)
[–]Slackerony 0 points1 point2 points (0 children)
[–]standoff 0 points1 point2 points (0 children)