Hi!

I got some problem when I tried to install Windows Server Update Services on my Test Windows Server 2012 Sp1 with SQL Server 2012 Sp1 installed. The Role installation worked fine. When after a post-installation runs it fails. After some research, I notice the post-installation didn’t found the wsusutil.exe tool (Wsus post-installation use this tool to do a post-installation). I’d a simple file search on server, and found the tool under c:\Program Files\Update Services\Tools. Run it from a powershell console:

 If you have install Wsus and choosed Database, run this command:

wsusutil.exe postinstall CONTENT_DIR="WSUS-CONTENT-PATH" SQL_INSTANCE_NAME="SQL-SERVER-NAME"


Skärmavbild 2013-09-04 kl. 11.20.08

If you have install Wsus and choosed WID database, run this command:

wsusutil.exe postinstall CONTENT_DIR=C:\WSUS INSTANCE_NAME="computername\database_instance_name"

Hello script geeks!

Today I want to talk about how you can easiest remove files and folder that is older than X days. You can get use of cmdlet Get-ChildItem to List all files and folder, where CreationDate i older than X days. And to remove the items get use of cmdlet Remove-Item.

Run following cmdlet:

$FilePath = "<-Path-> Ex: c:\test\" # Set Folder to check files and folder
$FileThatIsOlderThanDays = -7 # Set number of days back in time you will go

Get-ChildItem -Path ($FilePath) -Recurse | Where-Object {$_.CreationDate -le (Get-Date).AddDays($FileThatIsOlderThanDays)} | Remove-Item -Force

 

Here comes some instructions, howto Enable Powershell Remoting in a Windows Domain.

Step 1 – Set Powershell Execute Policy:

By Default the powershell allow only code-signed powershell script. To be able to change this settings to RemoteSigned (Enable Local scripts to run without to be signed. Scripts that is downloaded from the internet, must be signed.) you can do following:

  1. Create an new GPO ex: Set Computer Settings – Enable Powershell Remoting
  2. Right-click on new gpo and choose Edit
  3. Expand and goto ”Computer Configuration > Polices > Administrative Templates > Windows Components > Windows PowerShell
  4. Right-Click on Setting: Turn On Script Execution and choose Edit
  5. Turn on Policy setting, click on Radio-option Enable
  6. On Select Menu Execution Policy, Choose Allow local scripts and remote signed scripts
  7. Click Button OK

Step 2 – Allow remote Server Management through WinRM:

Enabling Powershell Remoting on every servers and clients in your environment you can do it from group policy.

  1. Right-Click on same GPO you just created Set Computer Settings – Enable Powershell Remoting and choose Edit
  2. Expand and goto ”Computer Configuration > Polices > Administrative Templates > Windows Components > Windows Remote Management (WinRM) > WinRM Service
  3. Right-Click on Setting: Allow remote server managment through WinRM and choose Edit
  4. Turn on Policy setting, click on Radio-option Enable
  5. On Options :
    1. IPv4 filter: * or specific ip-adress scope the service will be enable for
    2. IPv6 filter: * or specific ip-adress scope the service will be enable for
  6. Click Button OK

Step 3 – Turn on Service Windows Remote Management (WS-Management):

By Default Service ”Windows Remote Managment” is not turned on.  To turn on to every server and clients you have in your the windows environment, you can do it by a group policy.

  1. Right-Click on same GPO you just created Set Computer Settings – Enable Powershell Remoting and choose Edit
  2. Expand and goto ”Computer Configuration > Polices > Windows Settings > Security Settings > System Services
  3. Right-Click on Setting: Windows Remote Management (WS-Management) and choose Properties
  4. Click option and Select:  Define this policy setting
  5. Select Radio-option: Automatic
  6. Click Button OK

Step 4: Allow Windows Remote Managment through Windows Firewall:

Do this step If you have Windows Firewall Group Policy:

  1. Create an new GPO ex: Set Computer Settings – Configure Firewall
  2. Right-click on new gpo and choose Edit
  3. Expand and goto ”Computer Configuration > Polices > Windows Settings > Security Settings > Windows Firewall > Windows Firewall
  4. Right-Click on setting: Inbound Rules and choose New Rule
  5. Select Radio-Option: Predefined
  6. Choose in Select Menu: Windows Remote Managment (HTTP-In)
  7. Click Next until End of wizard.
  8. Right-click on the new Rule: Windows Remote Managment (HTTP-In)  and choose Properties
  9. Goto Tab:  Advanced and uncheck option Public.
  10. Goto Tab: Scope and add select radio-option These Ip adresses: Under Remote IP adress.
  11. Click on Add button
  12. Select Radio-Option: This IP adresses range
  13. In From Input option: ex: 192.168.1.100
  14. In To Input option: ex: 192.168.1.254
  15. Click on Button OK
  16. Click on Button Apply and then OK

Step 5 – Do a Group Policy Update:

  1. Start command prompt in admin context, and type following: Gpoupdate /force
  2. Press Enter.
  3. Or wait to next restart of your clients and servers.

Här kommer lite information och tips hur man går tillväga att testa applikationer som system-konto.

1. Ladda hem verktyg PSTOOLS och packa upp till en mapp – http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

2. Ta PSTOOLS mappen och klistra in den på system disk C:\

3. Starta Kommandotolken som administratör

4. gå till PSTOOLS mappen. C:\PSTOOLS

5. Kör följande verktyg PSEXEC.EXE -i -d -s cmd <Tryck Enter>

6. Nu kommer en villkorsruta upp. <Tryck på knapp Agree>

7. Nu kommer en till kommandotolken fönster upp. Nu kan du testa din applikation i det nya kommandotolken fönstret som körs som System.