Tag Info

Hot answers tagged

7

Hm, I think you have too many parameter sets. Also not sure why you have separate user/password parameters and a PSCredential parameter. You should really just use the PSCredential. But I'll assume you need this for some reason (please consider changing it). 4 parameter sets: ComputerNameCred ComputerNamePlain IpAddressCred IpAddressPlain function ...


6

To address the most basic part of your question: Yes, you can send commands to a Windows Server from a web interface using the PowerShell Web Access feature in Windows Server 2012 and 2012 R2. For what you want (linking a user control in a web page to the execution of a specific action on the server), you might want to look into executing PowerShell from ...


6

If you really want to know what exact LDAP queries are being performed by the Powershell Cmdlets, then you can decompile them by using DotPeek, using the method I outline here: https://www.myotherpcisacloud.com/post/2013/07/08/Taking-a-Peek-Inside-Powershell-Cmdlets.aspx Use $(Get-Command Get-ADUser).DLL to see what DLL the Cmdlet is being imported from. ...


6

By combining 2 scripts found somewhere online, I managed to figure it out. This is the script that did the job. #Accept input parameters Param( [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] [string] $Office365Username, [Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)] [string] $Office365Password ) ...


5

I think you are misunderstanding the use of the -NonInteractive switch; you can still run powershell -noninteractive and get an interactive prompt. The noninteractive switch is intended for automated scripting scenarios, where you don't want powershell to send a prompt to the user and wait for a response. For example, in a non-interactive PowerShell window, ...


4

Mark, I had a lot of fun tracking this down for you. I can totally see where your line of thought is, but you're asking the wrong question. The question should be "Why can't I establish a 'servermanagerworkflows' session on my machine?" If you look in the $enf:systemroot\system32\WindowsPowerShell\v1.0\Modules\RemoteDesktop and open the ...


4

The ActiveDirectory module has clever logic that calculate "popular" properties like whether a user account is Enabled or have PasswordNeverExpires set and presents them like regular attributes. Internally, they're derived from actual account attributes like userAccountControl and pwdLastSet. Account Settings userAccountControl is a bitfield, and contains ...


4

I think you'd have the best luck spending some time learning about the AD schema and building queries yourself, rather than trying to reverse-engineer Microsoft's own tools. AD is enough of a plain-vanilla LDAP directory that reference articles that speak about LDAP generally will be applicable. There are some oddball things like bit fields in attributes ...


3

The minimum requirements for Windows Management Framework 4.0 are Windows 7 SP1 and 2008 R2 SP1. Since this Q&A site is supposed to be about professional systems administration, I feel like we should probably not encourage people to "hack" or do "black magic" with their company's systems. You have 5000 Vista desktops, which is a significant asset. The ...


3

Microsoft is pretty clear: WMF 4.0 can only be installed on the following operating systems. Windows 7 with Service Pack 1 Windows Server 2008 R2 with Service Pack 1 Windows Server 2012 **You cannot install this software on computers that are running Windows 8.** Can't even install it on Windows 8.0, let alone Vista. So, your clients on Vista are ...


3

add `-noexit' PowerShell.exe -noexit -Command Enter-PSSession -computername Win2012SrvCore -credential administrator


3

No, you can't do this. Many of the PowerShell modules rely on OS-specific WMI namespaces. As these are not present in Windows 7, the modules cannot be imported. Powershell MVP Richard Siddaway details this in his blog.


3

The last 2 lines of BackupScript.ps1 are Write-Host "Press any key to close ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Comment these out (or delete them) and scheduled jobs should complete and exit cleanly. If you really want the pause at the end, replace the last line with something like this to wrap a timeout around it (each sleep is 1 ...


3

That T in "VistaT" is no T at all - it represents a trademark symbol: ™ (U+2122 or #8482 in Unicode) Try this: Get-Computers -OperatingSystem $("Windows Vista" + [char]8482 + " Business") Why Microsoft chose to abuse the ability to store unicode symbols in string value attributes in this way is beyond me. Here is how I found out: (When you cast a ...


3

Are you running this from an account that has the permissions to read these ADUser properties? Do you, perhaps, need to elevate the Powershell session? I ran this on my 7000+ account domain and all values were either true or false, no blanks.


3

Assuming you are talking about MS SQL. I don't think there is a way to tell just by looking at the file. This is why it's important to plan your backup process so as to take the guesswork out it, by using different file extensions like .bak, .diff, .trn, etc., to identify what type of file it is. Maybe you could try the restore verifyonly command: ...


2

Hi you might able to get the version with the following cmdlet Get-Host Work as well.


2

With 1000+ servers I assume you have a WSUS instance in your environment? You can get a lot of information from that with powershell. This is a snippet I use on our WSUS server (or via remote ps): $wsus = Get-WsusServer $servers = @("server1","server17","pol-server3","pol-server4") $servers | % { $servername = $_ $server = $wsus.GetComputerTargets() ...


2

Yes, you can override Get-ChildItem or any other cmdlet in Powershell. Name Your Function The Same If you make a function with the same name in the same scope, yours will be used. Example: Function Get-ChildItem { [CmdletBinding()] param( # Simulate the parameters here ) # ... do stuff } Using Aliases Create your own function, and then create ...


2

Yeah - have your exchange admin review the SMTP logs on the CAS server(s). Reviewing the logs is always the first thing to do. FYI - send-mailmessage will use your own AD credentials if you don't specify any, so you might be running into a problem where the receive connector is only allowing anonymous connections but you're using an authenticated session. ...


2

Invoke-Command: http://technet.microsoft.com/en-us/library/hh849719.aspx From the help: The Invoke-Command cmdlet runs commands on a local or remote computer and returns all output from the commands, including errors. With a single Invoke-Command command, you can run commands on multiple computers. To run a single command on a remote ...


2

You need DCOM ports and WSMan ports open. If you use Powershell v3+, by default DCOM range is 1024-5000, and WSMAN ports are 5985 (http) and 5986 (https). Hope it'll helps you. Regards


2

Here's a code I found and modified for this. $Merged = @() $Scopes = Get-DhcpServerv4Scope -ComputerName dc2008 #-ScopeId '10.1.230.0' Foreach ($Scope In $Scopes) { $IP_res = (Get-DhcpServerv4Reservation -ComputerName dc2008 -ScopeId $Scope.ScopeId) $IP_lease =(Get-DhcpServerv4Lease -ComputerName dc2008 -ScopeId $Scope.ScopeId) $IP_lease + ...


2

Solved! I had to use the 32-bit version of Powerhell as the module is in the folder: C:\Windows\System32\WindowsPowerShell\v1.0\Modules\


1

$passwd = convertto-securestring -AsPlainText -Force -String MYPASSWORD $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "administrator",$passwd $session = new-pssession -computername Win2012SrvCore -credential $cred Add one more line: Import-PSSession $session Then save the .PS1 file and create a shortcut to it as ...


1

If you import the AD powershell module you shouldn't need to use extra directoryservices objects (at least not on this occasion). You can use the Get-ADGroupMember cmdlet with -Resursive and it should find your nested users also. Edit: I added -Server arguments to the AD cmdlets so you can specify particular DCs. Timestamp attributes may differ (they do ...


1

This is a hack but it works. Grabbed the Get-ADUserLastLogon from a Microsoft Article (http://technet.microsoft.com/en-us/library/dd378867%28v=ws.10%29.aspx) Import-Module ActiveDirectory function Get-ADUserLastLogon([string]$userName) { $dcs = Get-ADDomainController -Filter {Name -like "*"} $time = 0 foreach($dc in $dcs) { $hostname = ...


1

In the K1000 v6 software, the system automatically enables "require authentication to download backup images" -- one needs to disable that feature or switch to ftp if they want to download system backups going forward.


1

This isn't possible at the moment with the Registry resource, as you've discovered. You can use a Script resource or write a full custom resource instead.


1

this is my solution thanks to briantist [CmdletBinding(DefaultParameterSetName="ComputerName")] Param ( # computername: Name of the host you want to connect to. [Parameter(Mandatory=$true,ParameterSetName="ComputerNameCred", Position=0)] [Parameter(Mandatory=$true,ParameterSetName="ComputerNamePlain", Position=0)] ...



Only top voted, non community-wiki answers of a minimum length are eligible